Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript cast String to Long / parseLong()

 
Adam Lim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript has parseFloat, but FYI Int in javascript is a float since JavaScript has only one number type.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic