Can someone help me with some form validation? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Can someone help me with some form validation? (/showthread.php?tid=76256)
Can someone help me with some form validation? by MeEtc on 07-22-2007 at 07:56 PM
I have an array of strings string variables in a constructor in a script that I am making. Can someone make me or provide the info for me to make a function that 1. confirms that no string is equal, and 2. no string contains spaces?
RE: Can someone help me with some form validation? by CookieRevised on 07-22-2007 at 09:12 PM
1) a) sort the array using the sort() function
b) check if one item is different than the one before it
2) Since you need to check on each item anyways in point 1, you can also immeditaly check the existance of spaces using the function indexOf().
Or you can do it after/before point 1 in one single line by joining all the elements of the array into a string and then using the function indexOf() on that joined string (but that requires more memory).
-----------------------------
[former placeholder of a lot of crap talk about how to loop through an array... thx to Markee for slapping me around a bit with some sense]
|