Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q39

irt.org | About | Feedback | 4317 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q39

Sent by
Marcos on December 13, 2002 at 12:57:50:

Worth:
Worth reading

Length:
Just right

Technical:
Just right

Comments:
There is another way using regular expressions, that won't mind leading zeroes. "/\D/" will check for anything that's not a digit (0-9) in the string:

var string = "123a4";
regexp = /\D/;
if (regexp.test(string))
alert(string + " is not a natural number.");





Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.