Obviously using the array.split function is very easy to use to separate lines of text by using "\n" or "\r" — however, when pasting data in from a word document, this does not identify nor split the linebreaks.
So just wondering, how can I make it so that the pasted contents of a word document can be separated by line? Obviously, I can’t copy/paste the linebreak from MS Word as this breaks the code (the compiler won’t have a bar of it), so I was wondering if there was a simple method of splitting text of this variation?
I can upload a .swf if necessary — I’m unsure if my explanation so far is reasonable. Basically, using the enter key in the text content results in recognisation of the linebreak, whereas pasting from MS Word does not.
Thanks all.
you could paste the sample of that text – or make available the file you are using, but you can try following:
where source is the string text from word
The regular expression above matches the windows style new line, then *nix and OSX type, then Mac OS 9 type. Windows new line is made of 2 cariage return and line feed but flash treats it separately in result you can get double line break in flash.
Also importatn thing is that line break and wrapped line is something different:) so it can be that in word you have line wrapped but it is one long line without any line breaks.