PDA

View Full Version : seperate numbers with delimeter


gyku
02-22-2009, 08:09 AM
var myStr:String
myStr=my_txt.text

Suppost text contains "1234,453,456,789,12"

I want to check that the number in between comma are less than 1000. How will i do this?

I tried doing this with indexOf and lastindexOf, but no luck.

I need the numbers within comma in a seperate variable so that i can compare it with 1000.

Any ideas?

panel
02-22-2009, 08:17 AM
the key to this puzzle is

var array:Array = str.split(",");

for(var i:uint = 0; i < array.length; i++)
{
var number:Number = Number(array[i]);

if(number > 1000)
trace("> 1000")
}