C#取中间文本

 1         /// <summary>
 2         /// 取中间文本 + static string GetMiddleStr(string oldStr,string preStr,string nextStr)
 3         /// </summary>
 4         /// <param name="oldStr">原文</param>
 5         /// <param name="preStr">前文</param>
 6         /// <param name="nextStr">后文</param>
 7         /// <returns></returns>
 8         public static string GetMiddleStr(string oldStr, string preStr, string nextStr)
 9         {
10             string tempStr = oldStr.Substring(oldStr.IndexOf(preStr) + preStr.Length);
11             tempStr = tempStr.Substring(0, tempStr.IndexOf(nextStr));
12             return tempStr;
13         } 

 

posted on 2014-01-04 14:52  iackjee  阅读(1172)  评论(0编辑  收藏  举报

导航