PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
CS3 Adition of two strings... How? (cast)?
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Adition of two strings... How? (cast)?

  1. #1
    Senior Member
    Join Date
    Sep 2006

    Adition of two strings... How? (cast)?

    Here we go... i know, that i have to CAST them... but how?
    The idea is to add (adition) two strings...
    a:String = "20";
    b:String = "10";

    c:String = a+b;

    I get c=2010 and not 30 as i expected...
    i guess i have to cast, but how?


  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    You're trying to add 2 strings together that why 20 + 10 = 2010. You first need to convert the strings into numbers and then add them together to achieve a proper mathematical addition. Try this,
    Actionscript Code:
    var c:String = String(Number(a)+Number(b));
    Wile E. Coyote - "Clear as mud?"

Posting Permissions

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

Click Here to Expand Forum to Full Width

HTML5 Development Center