lundi 6 février 2017

Separate strings in a string with Actionscripts3

I'm trying to separate two part of a string, one is Title one is Value, RegExp is confused me. I need your help to solve this thanks

var pattern2:RegExp = new RegExp("TZ_NUM_ANSWER:Telegram code([0-9.-]+)");//TZ_NUM_ANSWER:Telegram code 32263
       var data2:Object = pattern2.exec(response);
       if (data2 != null && data2[1] != null) 
       {
         var value2:Number = parseFloat(data2[1]);
         trace("TZ_NUM_ANSWER  " + value2);
         txt_BUY1.text = String(value2);
       }

Output:

TZ_NUM_ANSWER:Telegram code 32263

It must be:

"TZ_NUM_ANSWER:" "Telegram code 32263"

Aucun commentaire:

Enregistrer un commentaire