Please see my comments. Everything is already in your question. Apparently, to filter out "unused words", you need to know them all and prepare some dictionary of them, in fact, just a list. Convert them all in lower case (for example). And then,
string messageFormat = @"The word ""{0}"" is a bad one. Did you mom teach your to be nice?"
string message;
string content = myTextBox.Text.ToLower();
foreach(unusedWord in unusedWordList)
if (content.Contains(unusedWord)) {
message = string.Format(messageFormat, unusedWord);
break;
}
Please see:
http://msdn.microsoft.com/en-us/library/system.string.aspx[
^],
http://msdn.microsoft.com/en-us/library/e78f86at.aspx[
^],
http://msdn.microsoft.com/en-us/library/dy85x1sa.aspx[
^].
Note: during answering this question, no "unused words" were written. Do you need to explain why? Simple: because hard-coding of
immediate constants is a great sin for a software developers.
To be completely honest, I must confess that some "unused words" came to my mind during reading of the question. I resisted it; please appreciate that. :-)
—SA