AS3 Remove Carriage Returns And New Lines Using Regular Expressions


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function removeCarriageReturnsAndNewLines($myString:String):String {
  2. var newString:String;
  3. var findCarriageReturnRegExp:RegExp = new RegExp("\r", "gi");
  4. newString = $myString.replace(findCarriageReturnRegExp, "");
  5. var findNewLineRegExp:RegExp = new RegExp("\n", "gi");
  6. newString = newString.replace(findNewLineRegExp, "");
  7. return newString;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.