Travelling Sales Person in Flash

Hello,

I’m doing an assignment at school that requires the use of plain formatted text files.

I can get them into flash fine, but I can’t get the text split and put into an array properly.

Eg.
" 1 5000"
“10 5000”

Theres a space infront the the 1 is in first example, so that will be array[0]. But I want array[0]=1

When I try to split it by " ", and then remove any blanks in my array, it really goes crazy when there is two spaces, or three. Coupled that with flash bringing in the newline character, my codes getting a bit crazy, and very slow.

Is there any easy way to split text files into an array?