当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > asp.NET 脏字过滤算法

ASP.NET
合理的网盟广告策略:如何规划与投放网盟广告
GoDaddy Backorder域名抢注经验分享
Google Analytics获得GOOGLE真正的收录网站数据指标
Visual Studio 2008 Team Suite简体中文正式版- 激活方法

ASP.NET 中的 asp.NET 脏字过滤算法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 33 ::
收藏到网摘: n/a

asp.NET 脏字过滤算法,需要参考上一篇文章,大家可以比较下。 原文见http://www.ruanchen.com/"codetitle">复制代码 代码如下:

使用的时候
复制代码 代码如下:

int index = 0;
while (index < target.Length)
{
if (!fastcheck[target[index]])
{
while (index < target.Length - 1 && !fastcheck[target[++index]]) ;
}
for (int j = 0; j < Math.Min(maxlength, target.Length - index); j++)
{
string sub = target.Substring(index, j);
if (dic.ContainsKey(sub))
{
sb.Replace(sub, "***", index, j);
index += j;
break;
}
}
index++;
}

评论 (0) All

登陆 还没注册?