c#indexof用法

来源:互联网 发布:js 日期 编辑:程序博客网 时间:2024/05/18 01:08

IndexOf()
查找字串中指定字符或字串首次出现的位置,返首索引值,如:
str1.IndexOf("字"); //查找“字”在str1中的索引值(位置)
str1.IndexOf("字串");//查找“字串”的第一个字符在str1中的索引值(位置)
str1.IndexOf("字",start,end);//从str1第start+1个字符起,查找end个字符,查找“字”在字符串STR1中的位置[从第一个字符算起]注意:start+end不能大于str1的长度

http://community.csdn.net/Expert/TopicView3.asp?id=5211359

 
原创粉丝点击