码迷,mamicode.com
首页 > Windows程序 > 详细

C# 过滤特殊字符

时间:2015-04-13 09:20:19      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

#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

C# 过滤特殊字符

标签:

原文地址:http://www.cnblogs.com/xiaohaizhuimeng/p/4421259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!