namespace c_03zy
{
class Program
{
static void Main(string[] args)
{
// 1.取出该文件名“abcd.cs”的后缀名。
//string a = “abcd.cs”;
//int index = a.IndexOf(‘.’);
//Console.WriteLine(a.Substring(a.IndexOf(‘.’),a.Length-index));
//Console.ReadKey();
//2.判断邮箱格式是否正确(@出现的位置要前于.出现的位置)
//string a = "123123@qq.com";
//int b = a.IndexOf('@');
//int c = a.IndexOf('.');
//if (b > c)
//{
// Console.WriteLine("邮箱格式错误");
//}
//else
//{
// Console.WriteLine("邮箱格式正确");
//}
//Console.ReadKey();
//3.控制台接收输入(类似“aa @bb”字符串),判断以“@”分割的前后两个字符串是否相等。
string a = "aa@bb";
int index = a.IndexOf('@');
// Console.WriteLine(index);
string b = a.Substring(a.Length - index, a.IndexOf('@'));
string c = a.Substring(0, a.IndexOf('@'));
if (b.Equals(c))
{
Console.WriteLine("相等");
}
else
{
Console.WriteLine("不相等");
}
Console.ReadKey();
//4.定义“好好学习,天天向上”这个字符串,将字符串中“天天”两个字替换为“时时”,要求结果字符串为“好好学习,时时向上”
//string a = "好好学习,天天向上";
//Console.WriteLine(a.Replace("天天","时时"));
//Console.ReadKey();
//5.定义char字符'a',判断是不是大写,是不是小写,是不是数字,然后转换为大写输出
//char a = 'a';
//bool b=char.IsUpper(a);
//bool c = char.IsLower(a);
//bool d = char.IsNumber(a);
//if (b ==true)
//{
// Console.WriteLine("这是大写");
//}else if(c==true){
// Console.WriteLine("这是小写");
// Console.WriteLine(char.ToUpper(a));
//}
//else
//{
// Console.WriteLine("这是数字");
//}
//Console.ReadKey();
}
}
}