Possible Duplicate:
How do you implement a good profanity filter?
I have to take a city name from users as input, but I don't want to accept any profanities. Can anyone tell me how I can keep users from typing such words?
Possible Duplicate:
How do you implement a good profanity filter?
I have to take a city name from users as input, but I don't want to accept any profanities. Can anyone tell me how I can keep users from typing such words?
You'd have to scan the input for all vulgarity, either post-entry or during the entry, and reject the content then. Inversoft (http://www.inversoft.com/) has a web service available that can help; you can also do a google search for "java profanity filter" to find other similar products.
Of course users will not be able to enter names of actual cities which are also profanities. By definition, you are excluding such cities.