Checking array of censored words against user submitted content
Posted
by steve-o
on Stack Overflow
See other posts from Stack Overflow
or by steve-o
Published on 2010-05-21T08:14:53Z
Indexed on
2010/05/21
8:20 UTC
Read the original article
Hit count: 141
Hello, I have set up an array of censored words and I want to check that a user submitted comment doesn't contain any of these words. What is the most efficient way of doing this? All I've come up with so far is splitting the string into an array of words and checking it against the array of censored words, but I've a feeling there's a neater way of doing this.
© Stack Overflow or respective owner