复制代码 代码如下:
public static string Replace(string oldStr)
{
if (string.IsNullOrEmpty(oldStr))
{
return "";
}
string str2 = Regex.Replace(oldStr, @"[\[\+\\\|\(\)\^\*\""\]'%~#-&]", delegate(Match match)
{
if (match.Value == "'")
{
return "''";
}
else
{
return "[" + match.Value + "]";
}
});
return str2;
}
查看更多关于使用DataTable.Select 方法时,特殊字符的转义方法分享的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did28861