C#一个非常使用的寻找字符串函数

        public static string Search_string(string s, string s1, string s2)  //获取搜索到的数目  
        {  
            int n1, n2; 
            n1 = s.IndexOf(s1, 0) + s1.Length;   //开始位置  .            
            n2 = s.IndexOf(s2, n1);               //结束位置  
            return s.Substring(n1, n2 - n1);   //取搜索的条数,用结束的位置-开始的位置,并返回  
       } 

你可能感兴趣的:(C#编程)