Click search type "bad word filter" bask in the glory of the forums... and topics covered plenty... like: http://forum.unity3d.com/threads/how-to-replace-bad-words-in-c.277673/
If you need help coming up with bad words to look for, ask me... I know a lot of 'em. But I would do something like what @hpjohn suggested. Store all the bad words in a string array. Then when you're checking input, search for those bad word strings inside the input string, and either replace them with a censor or prohibit the action, whichever is appropriate for you.
It's easy to implement, tough to get right. Search it as I said and read through some of it. As in the example above: string goodText = badText.Replace("Ass","***"); Take this as an example: The Assassin ran up and kicked you in the ass! That version of replace does: The ***assin ran up and kicked you in the ass! For filtering you need more than just a replace, you'd need to check case, spelling, slang, and embedded words to make sure you aren't blocking legit words like the poor assassin.
It's pretty sloppy, but you could add variations for each possibility. Code (CSharp): public string[] awesomeWords = new string[] {" ass ", " ass.", " ass,", " ass;" ...} It would end up being a LOOOOOOONG array, and I'm sure you'd miss specific combinations. Maybe a better way would be to have an array of the naughty words, then loop through and search for those strings in the sentence. If found, check the characters preceding and following the string. If the string is at the start of the message OR the preceding character is a space or in a punctuation array AND the character after is a space or in a punctuation array OR the string is at the end of the message, block. I believe that would cover most real world cases. Are people going to find a way to game it and get a curse word in? Of course. But I think the idea is you do what you can to reasonably block offensive material and deal with offenders that slip through as necessary. Best example ever.