關於
主要算法如代碼所示
以下是引用片段
private static Dictionary dic = new Dictionary();
private static BitArray fastcheck = new BitArray(char
static void Prepare()
{
string[] badwords = // read from file
foreach (string word in badwords)
{
if (!dic
{
dic
maxlength = Math
int value = word[
fastcheck[word[
}
}
}
使用的時候
以下是引用片段
int index =
while (index < target
{
if (!fastcheck[target[index]])
{
while (index < target
}
for (int j =
{
string sub = target
if (dic
{
sb
index += j;
break;
}
}
index++;
}
From:http://tw.wingwit.com/Article/program/net/201311/15026.html