字符串截取
/// <summary> /// 截取字符串 /// </summary> /// <param name="str">原始字符</param> /// <param name="beginStr">开始字符串</param> /// <param name="endStr">结束字符串</param> /// <returns></returns> public string getString(string str, string beginStr,bool beginYN,string endStr,bool endYN) { int beginIndex = str.IndexOf(beginStr) + (beginYN ? 0:beginStr.Length); int endIndex = str.IndexOf(endStr)+(endYN ? beginStr.Length: 0); return str.Substring(beginIndex, endIndex- beginIndex); }