如何防止用户输入脏话?
可能的重复:
如何实现良好的脏话过滤器?
我必须从用户那里获取城市名称作为输入,但我不想接受任何亵渎。谁能告诉我如何阻止用户输入这些单词?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然,用户将无法输入实际城市的名称,这也是亵渎的。根据定义,您排除了这些城市。
Of course users will not be able to enter names of actual cities which are also profanities. By definition, you are excluding such cities.
您必须在输入后或输入期间扫描输入中的所有粗俗内容,然后拒绝该内容。 Inversoft (http://www.inversoft.com/) 有一个网络服务可以提供帮助;您还可以在 google 上搜索“java profanity filter”来查找其他类似产品。
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.