Tuesday, January 4, 2011

replacing line breaks in actionscript

replacing line breaks in actionscript:

Here's a quick code snippet to replace windows-style line breaks (CRLF, or carriage return, line feed) with a standard actionscript new line character. var newText:String = oldText.replace(/\r\n/g, '\n'); and here's a snippet to replace all multiple line breaks with a single new line character: var newText:String = oldText.replace(/[\r\n]+/g, '\n'); for example, the preceding code would change the following string: ab to this: [...]

No comments:

Post a Comment