30 Nov 2008 at 19:32 #1 Energize Energize Caporegime Joined 12 Mar 2004 Posts 29,962 Location England What function can I use to determine if a char in a string is numeric?
30 Nov 2008 at 19:44 #2 DireEmblem DireEmblem Associate Joined 25 Aug 2008 Posts 947 Try this, btw it does more than 0-9... http://java.sun.com/j2se/1.3/docs/api/java/lang/Character.html#isDigit(char)
Try this, btw it does more than 0-9... http://java.sun.com/j2se/1.3/docs/api/java/lang/Character.html#isDigit(char)
30 Nov 2008 at 19:49 #3 Augmented Augmented Soldato Joined 18 Oct 2002 Posts 5,464 Location London Town You can check if it's not a number - isNaN and flip the return value to get true for numbers. Code: var string = '42'; alert(!isNaN(string));
You can check if it's not a number - isNaN and flip the return value to get true for numbers. Code: var string = '42'; alert(!isNaN(string));
30 Nov 2008 at 19:56 #4 Energize Energize Caporegime OP Joined 12 Mar 2004 Posts 29,962 Location England Hmm I get the error message (name.charAt(i)).isLetter() is not a function.
30 Nov 2008 at 20:08 #5 Augmented Augmented Soldato Joined 18 Oct 2002 Posts 5,464 Location London Town Energize said: Hmm I get the error message (name.charAt(i)).isLetter() is not a function. Click to expand... charAt()/isLetter() are Java functions, not Javascript.
Energize said: Hmm I get the error message (name.charAt(i)).isLetter() is not a function. Click to expand... charAt()/isLetter() are Java functions, not Javascript.
30 Nov 2008 at 20:18 #6 Energize Energize Caporegime OP Joined 12 Mar 2004 Posts 29,962 Location England Ah, I didn't think you could use java functions either but the other poster decieved me.
30 Nov 2008 at 21:25 #7 DireEmblem DireEmblem Associate Joined 25 Aug 2008 Posts 947 my bad, misread post
1 Dec 2008 at 13:13 #8 SimonCHere SimonCHere Associate Joined 24 Jun 2008 Posts 1,168 var string = name.charAt(i); alert(!isNaN(string));