C#中String类方法汇总

以下对C#中string类的方法进行汇总:

1.string (char[])      使用指定的字符串数组构建一个新的string对象

2.int Compare(string a,string b,bool case)     比较字符串a,b,case为true时表示不区分大小写。当a>b返回正数,当a<b返回负数,a=b返回0

3. bool EndsWith(string)         确定当前字符串是否以指定的字符串结尾

4. bool StartsWith(string)         确定当前字符串是否以指定的字符串开头

5.int IndexOf()               返回指定的字符或字符串在当前字符串中的位置

6.int  LastIndexOf()        返回指定字符或字符串的最后一个匹配项位置

7.string Insert(int,string)         在当前的字符串中插入一个指定的字符串

8.string Replace

猜你喜欢

转载自www.cnblogs.com/zengxh/p/12390570.html
今日推荐