删除最后结尾的指定字符后的字符

#region 删除最后结尾的指定字符后的字符
 2         /// <summary>
 3         /// 删除最后结尾的指定字符后的字符
 4         /// </summary>
 5         public static string DelLastChar(string str, string strchar)
 6         {
 7             if (string.IsNullOrEmpty(str))
 8                 return "";
 9             if (str.LastIndexOf(strchar) >= 0 && str.LastIndexOf(strchar) == str.Length - 1)
10             {
11                 return str.Substring(0, str.LastIndexOf(strchar));
12             }
13             return str;
14         }
15         #endregion
复制代码
原文地址:https://www.cnblogs.com/zhangxiaolei521/p/5808656.html