This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Javascript cast String to Long   / parseLong() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript cast String to Long   / parseLong()" Watch "Javascript cast String to Long   / parseLong()" New topic
Author

Javascript cast String to Long / parseLong()

Adam Lim
Greenhorn

Joined: Mar 13, 2007
Posts: 5
Hello,

i wish to make 00000000001234567890 to 1234567890.

i know that javascript do not provide parseLong() function.

How can i cast String 20 digit to Long? if i use parseInt(), may hit NumberFormatException due to out of range.


please advise.

thank you.


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
JavaScript has parseFloat, but FYI Int in javascript is a float since JavaScript has only one number type.

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Javascript cast String to Long / parseLong()
 
Similar Threads
parseLong(String s, int radix) - What is a radix ?
Performance difference between Long.longValue() and Long.parseLong()
a wrapper class question
parseLong(String s, int radix) ...What is a radix ?
Cast a String to a long?