查询条件过滤替换特许符号
public static string SpecialSymbols(string strText) { strText = strText.Trim(); strText = strText.Replace("!", "‘ + char(33) + ‘"); strText = strText.Replace("\"", "‘ + char(34) + ‘"); strText = strText.Replace("$", "‘ + char(36) + ‘"); strText = strText.Replace("%", "‘ + char(37) + ‘"); strText = strText.Replace("&", "‘ + char(37) + ‘"); strText = strText.Replace("‘", "‘ + char(39) + ‘"); strText = strText.Replace("(", "‘ + char(40) + ‘"); strText = strText.Replace(")", "‘ + char(41) + ‘"); strText = strText.Replace("*", "‘ + char(42) + ‘"); strText = strText.Replace("+", "‘ + char(43) + ‘"); strText = strText.Replace(",", "‘ + char(44) + ‘"); strText = strText.Replace("-", "‘ + char(45) + ‘"); strText = strText.Replace(".", "‘ + char(46) + ‘"); strText = strText.Replace("/", "‘ + char(47) + ‘"); strText = strText.Replace("", "‘ + char(47) + ‘"); return strText; }
可继续补充或者优化,未测试。
时间: 2024-10-25 11:07:07