my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes isNaN function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "isNaN function" Watch "isNaN function" New topic

isNaN function

Saurabh Naik
Ranch Hand

Joined: Apr 24, 2008
Posts: 87
isNaN function only checks first letter in string.. but what suppose I have string like sa89bh.

is there any function for recognizing numbers in string ?

which are the built in functions in java script .

SCJP 6 (88%), SCWCD 5 (78%), preparing for SCBCD
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Reg exps

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

If the first letter is not a numeral, that's all isNan needs to know to determine if it's a number of not.

If you are trying to find embedded numbers, why would you use isNan? I'd consider exploring regular expressions.

Edit: As Eric suggested while I was posting.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: isNaN function
It's not a secret anymore!