标签:sse style string reg span 字符串 color ram pass
/// <summary> /// 替换部分字符串 /// </summary> /// <param name="sPassed">需要替换的字符串</param> /// <returns></returns> public static string ReplaceString(string JsonString) { if (JsonString == null) { return JsonString; } if (JsonString.Contains("\\")) { JsonString = JsonString.Replace("\\", "\\\\"); } if (JsonString.Contains("\‘")) { JsonString = JsonString.Replace("\‘", "\\\‘"); } if (JsonString.Contains("\"")) { JsonString = JsonString.Replace("\"", "\\\""); } //去掉字符串的回车换行符 JsonString = Regex.Replace(JsonString, @"[\n\r]", ""); JsonString = JsonString.Trim(); return JsonString; }
标签:sse style string reg span 字符串 color ram pass
原文地址:http://www.cnblogs.com/wuyujie/p/7656488.html