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 }