May
27
27
How to remove Bad Words in C#
public string RemoveBadWords(string UserComments, ArrayList BadWordsList)
{
Regex regBad = default(Regex);
IEnumerator ieBadWords = BadWordsList.GetEnumerator();
while (ieBadWords.MoveNext())
{
regBad = new Regex(”\\b” + ieBadWords.Current.ToString());
UserComments = regBad.Replace(UserComments, “yourtext”);
}
return UserComments;
}
There are no comments.