Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
Newlines in xml
I was trying to split a string on a newline character today and having some issues. The string was a text node loaded from an xml file, and i could see that the line breaks were coming in intact. However when i tried to split the string on the “\n” character, it wouldn’t work. Long story short, internally flash represents a newline character as “\r”, so string.split(“\r”) works fine.
| Print article | This entry was posted by rich on July 10, 2007 at 11:25 am, and is filed under flash. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 3 years ago
That’s certainly one thing that I wish was more consistent across systems. In Javascript, I am pretty sure the line break is \n, not \r. On Windows machines, I think they use \r\n. On *nix machines I think they use just \n. In ColdFusion, GetToken() won’t use both \r and \n as a token delimiter, just one (but I can’t remember which one, I think \n).
Anyhow, it’s frustrating and I wish it was more consistent.
about 2 years ago
Thanks! You just saved me several minutes of grief…
about 7 months ago
Thank you very much. This is what I’m looking for