C# 过滤特殊字符

#region 过滤特殊字符
/// <summary>
/// Delete special symbol
/// </summary>
/// <param name="str">需要过滤的字符串</param>
/// <returns></returns>
public string DelQuota(string str)
{
string result = str;
string[] strQuota = { "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "`", ";", "'", ",", "/", ":", "/,", "<", ">", "?", "|" };
foreach (string item in strQuota)
{
if (result.Contains(item))
{
result = result.Replace(item, "");
}
}
return result;
}
#endregion

posted @ 2015-04-13 08:37  Kevin_Zhou_9  阅读(1464)  评论(0编辑  收藏  举报