String类
//String Math string a = " aldsfdh "; //bool q = a.Contains("dd");//是否包含此字符串 int o = a.IndexOf("h"); Console.WriteLine(o); int p = a.LastIndexOf("d"); Console.WriteLine(p); int b = a.Length;//长度 Console.WriteLine(b); string c = a.Trim();//去掉前后空格 Console.Write(c); string d = a.TrimStart();//去掉前空格 Console.Write(d); string e = a.TrimEnd();//去掉后空格 Console.Write(e); string f = a.ToUpper();//全部将小写字母转换为大写 Console.Write(f); string g = a.ToLower();//全部将大写字母转换为小写 Console.Write(g); //索引是从0开始的 string h = a.Substring(4);//里面一个值,表示从这个索引值开始一直截取到最后 Console.WriteLine(h); Console.WriteLine(a.Substring(8));//a=a.Substring(8);//若不重新赋值,a无变化 string i = a.Substring(4, 3); Console.WriteLine(i); a = a.Replace("de", "DE"); Console.WriteLine(a); string j = "2012/12/23"; string[] aa = j.Split();//分割字符串,
判断邮箱格式是否正确