Strings to numbers

Results 1 to 3 of 3

Thread: Strings to numbers

  1. #1
    MGG Guest

    Default Strings to numbers

    How do I convert a string to a number? Anyone

  2. #2
    Join Date
    Dec 1969

    Default RE: Strings to numbers

    var newstring = youroldstring - 0;

  3. #3
    OLZ Guest

    Default OR......

    be careful - you don&#039;t want to be calling your variable newstring if it is actualy a number! it won&#039;t break, but it&#039;s not good form!<BR><BR>You can also try....<BR>var x= eval(oldstring);<BR><BR>or if you know it&#039;s an integer.<BR>var x = parseInt(oldstring);<BR><BR>if it&#039;s a float you are after...<BR>var x = parseFloat(oldstring) --- better check this one - I might be making it up!<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts