Created
January 4, 2011 03:42
-
-
Save geraldyeo/764356 to your computer and use it in GitHub Desktop.
REPLACING LINE BREAKS IN ACTIONSCRIPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: | |
// a | |
// | |
// | |
// b | |
// | |
// to this: | |
// a | |
// b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment