C#正则表达式判断是否含有指定字符并去除

时间:2014-12-19 17:27:39   收藏:0   阅读:455
/// <summary>
        /// 处理json字符串,将[]{}'"字符去除
        /// </summary>
        /// <param name="JsonStr">需处理的字符串</param>
        /// <returns>处理后的字符串</returns>
        public static string DealJsonStr(string JsonStr)
        {
            Regex regex = new Regex(@"[\]\[\}\{""\']+");
            Match match = null;
            while ((match = regex.Match(JsonStr)).Success)
            {
                JsonStr = JsonStr.Replace(match.Value, string.Empty);
            }
            return JsonStr;
        }

原文:http://blog.csdn.net/wenyan07/article/details/42029359

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!