|
-
Who needs pants?
Whats faster?
Hey guys/gals im just making a user registration page and i want to validate the username so it's not a swear word. I thought about 2 ways to do this one is have a list of swear words in a txt file on new lines and check that file, or have a table in my database full of naughty words and check that. I already have a check to see if the username already exists. Dont want to make to many calls to the database. But which way would be better and faster?
-
Registered pseudo intellectual
If your going to open a batabase connection on the registration page in any case, it's probably going to be as fast as reading and splitting strings from a file, and easier to manage. If not, its more likely to be quicker reading from a file. Read the swear words into a string array, and check each lowercase word with the array with the potential bad word (in lowercase) using userInputString.ToLowerCase().Contains(badWord.ToL owerCase()); or something similar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|