Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

line break and enter char codes

Explorer ,
Jul 17, 2012 Jul 17, 2012

Hi,

I'm working on an app that user will be able to change lyrics in input text fields. I have loaded txt file for example like this:

"

|Light|ly |row,| |light|ly |row,|

|O'er |the |glas|sy |waves |we |go!|

|Smooth|ly |glide,| |smooth|ly |glide,|

|On |the |si|lent |tide.|||

"

I let people change lyrics and save it to new txt file. Pipes divides syllables. After user text customization I would like to have text in the same format as original and it's working fine. The thing is I don't know how to deal with line breaks and enter in strings. Output txt file (sent to php sript to write to file) is something like this:

"

|Light|ly |row,| |light|ly |row,||O'er |the |glas|sy |waves |we |go!||Smooth|ly |glide,| |smooth|ly |glide,||On |the |si|lent |tide.|||

"

In output txt file I loose all line break data. But If I copy that txt content to doc file, all line break formating data will be there.

I have tried to loop through output string chars and I found that charcodes 10, and 13 are in place, but not displayed in txt file.

At this stage I would like to replace linebreaks with custom # mark for example. I have tried this:

var charcode:uint = 10;

var char = String.fromCharCode(charcode);

var newString = _newLyrics.replace(char, '#');

But it replaced only first char in string.

How could I use regexp with charcodes ?

How is that char 10, and 13 are displayed in trace statements and actually are in the string but not formatted corectlly in txt file?

Any ideas?

TOPICS
ActionScript
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 17, 2012 Jul 17, 2012

a line break is \n and a carriage return is \r.  (and, if you need a tab, \t).

Translate
Community Expert ,
Jul 17, 2012 Jul 17, 2012
LATEST

a line break is \n and a carriage return is \r.  (and, if you need a tab, \t).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines