PDA

View Full Version : string splitting error



ArmoredSandwich
December 25th, 2007, 10:09 AM
Okay, for my map editor i need to be able to read text files (loading maps to edit).

I was unable to load text files, so i decided you should just copy paste the code in a text file.

Now i need flash to read the string and place the tiles. The problem is that I cant split strings on enters. C# uses '\n'. Z said I should use '
'. The c# method aint working and I get an error if I try to do what Z said (String literal was not properly terminated).

I use something like this:
var lines:Array = input.split(new String('\n'));

Thank you

-Z-
December 25th, 2007, 11:12 AM
here is how I do it in my isometric project

var pdata:Array = data.split('|');

the enter thing is actually what I did in php, I remember now, in AS I have never tried it..

ArmoredSandwich
December 25th, 2007, 11:18 AM
here is how I do it in my isometric project

var pdata:Array = data.split('|');

the enter thing is actually what I did in php, I remember now, in AS I have never tried it..

actually: that is working, but the enter isnt :(

ArmoredSandwich
December 25th, 2007, 07:02 PM
carriage return xD

.split("\r");

omg, wasted so much of my time.. but atleast it works :)

-Z-
December 25th, 2007, 09:43 PM
:) hehe at least you got it.