Jump to content

filtering user input


tamir
 Share

Recommended Posts

i think there is a more proper way but my solution would be to check for those characters in the while loop and if they show up automaticly delete them and play the error noise. some one else probably has a better solution though

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

i think there is a more proper way but my solution would be to check for those characters in the while loop and if they show up automaticly delete them and play the error noise. some one else probably has a better solution though

<{POST_SNAPBACK}>

I would do it this way, myself.

Check for the existance of illegal characters with a StringSplit, For, StringIsXXX, Set Flag, Next loop.

Dim $input, $inputarray, $flag = 0
Do
   $input = InputBox("Test","Put test text here")
       If @error = -1 then Exit
   $inputarray = $input
   StringSplit($inputarray,""); splits each element into an array.

   For $x = 1 to $inputarray[0] step 1
      If StringIsAlpha($inputarray[$x]) = 0 or _ 
          StringIsDigit($inputarray[$x]) = 0 then $flag = 1
   Next
   If $flag = 1 then MsgBox(48,"Error","Illegal Characters Specified." & _
       @LF & "Please use only letters and numbers.",5)
Until $flag = 0
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...