首页 > 代码库 > C# 取文本左边

C# 取文本左边

        /// <summary>          /// 取左边文本          /// </summary>          /// <param name="SumString">总文本</param>          /// <param name="LeftString">左边文本</param>          /// <returns>找到返回取出的左边文本,没找到返回空</returns>         public static string GetLeftString(string SumString, string LeftString)        {            if (string.IsNullOrEmpty(SumString)) return "";            if (string.IsNullOrEmpty(LeftString)) return "";            int LeftIndex = SumString.IndexOf(LeftString);            if (LeftIndex == -1) return "";            return SumString.Substring(0, LeftIndex + LeftString.Length-1);        } 

 

C# 取文本左边