1、C# string属性IndexOf的用法——IndexOf()
2、IndexOfAny、LastIndexOfAny
返回数组中任何一个字符最早出现的下标位置,索引仍然是从‘0’开始
例如:
char[] bbv={‘s‘,‘c‘,‘b‘};
string abc = "acsdfgdfgchacscdsad";
LastIndexOfAny 同上。
3、substring()的用法
"abcdefg".substring(4,2)
返回的值为:ef
从字符串"abcdefg"中第4位开始取,取到第2位
"abcdefg".substring(4)
返回:efg
从字符串"abcdefg"中第4位开始取,取到字符串的尾部
4、查询字符串是否包含某字符——contain()
string str1="12345";
if(str1.contain("123"))
{
messagebox.show("存在数据");
}
原文:http://www.cnblogs.com/tulingling/p/6380780.html