A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Whats faster?

  1. #1
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976

    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?

  2. #2
    Registered pseudo intellectual
    Join Date
    May 2005
    Location
    ol' Blighty
    Posts
    48
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center