check if string is interpretable as int

Nov 21, 2006 at 10:16pm

check if string is interpretable as int

Hi,

This might be a very basic question: is there a way in javascript to determine whether a string is interpretable as an int?

In java there is Integer.parseInt(String). Is there something similar in javascript? I didn’t find it in docs so far.

Cheers,
Mattijs

#28819
Nov 21, 2006 at 10:30pm

Ok, sorry. Found it. I was confused because parseInt gave a strange output when posted, “1#R” if not cast to string. And I found the isNaN method :)

Thanks,
Mattijs

#88867

You must be logged in to reply to this topic.