2020-01-16 22:03发布
可参考以下代码:
/// <summary> /// 取中间文本 + static string GetMiddleStr(string oldStr,string preStr,string nextStr) /// </summary> /// <param name="oldStr">原文</param> /// <param name="preStr">前文</param> /// <param name="nextStr">后文</param> /// <returns></returns> public static string GetMiddleStr(string oldStr, string preStr, string nextStr) { string tempStr = oldStr.Substring(oldStr.IndexOf(preStr) + preStr.Length); tempStr = tempStr.Substring(0, tempStr.IndexOf(nextStr)); return tempStr; }
最多设置5个标签!
可参考以下代码:
/// <summary> /// 取中间文本 + static string GetMiddleStr(string oldStr,string preStr,string nextStr) /// </summary> /// <param name="oldStr">原文</param> /// <param name="preStr">前文</param> /// <param name="nextStr">后文</param> /// <returns></returns> public static string GetMiddleStr(string oldStr, string preStr, string nextStr) { string tempStr = oldStr.Substring(oldStr.IndexOf(preStr) + preStr.Length); tempStr = tempStr.Substring(0, tempStr.IndexOf(nextStr)); return tempStr; }
一周热门 更多>