string是经常用到的:
常用的方法有:
- IndexOf( ):查找某个字符在字符串中的位置
输出结果为9static void Main(string[] args) { string str = "123456789@qq.com"; int n = str.IndexOf("@"); Console.WriteLine("N的值为:" + n); Console.ReadKey(); }
- Substring(int startIndex,int length):从字符串中截取子字符串,length为子字符串的长度
输出结果为345static void Main(string[] args) { string str = "123456789@qq.com"; string s = str.Substring(2,3); Console.WriteLine("S的值为:" + s); Console.ReadKey(); }
- ToLower和ToUpper:将字符串转换成小写和大写的形式
- 字符串比较:==比较的是地址,Equals比较的是内容
- Split( )详细内容请看http://www.cnblogs.com/luluping/archive/2009/04/30/1446654.html