您的位置:首页 > 其它

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

2016-08-25 22:49 363 查看
#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


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: