DISQUS

Tech-Recipes: AS3: How to Convert Number to String | Computer programming | Tech-Recipes

  • littleman80 · 1 year ago
    how about if I have a number, i.e.: 23 and I want to converted it to the string "0023" (with 4 digits i.e.)?...
  • justin · 11 months ago
    same problem
    I'm getting a number from an XML, looks like 123,456,78
    i then myString.split(",").join("");
    gives me "12345678"
    now I want to use it in some math,
    i tried Number(myString);
    that just gives me the error above
  • jk · 10 months ago
    How to do whith that?:

    var D:String;
    D = String(b * b - 4 * a * c);
  • Daniel · 7 months ago
    thats cool man, but how would you know wich class to add so you can use the "string()" converter
  • jenny · 6 months ago
    or you could use (time.milliseconds).toString()
  • Christo · 6 months ago
    That doesn't work.
  • Roberto · 6 months ago
    @ littleman80
    var num:Number = 23;
    var StringConverted:String = "00"+String(num);
    trace(StringConverted);

    @justin
    to convert a string to number use this
    var TheString:String = "12345678";
    var TheNumber:Number = parseInt(TheString);
    trace(TheNumber * 2) // by using * u can test that its really a number