AS3 Remove Tabs and NewLine Characters


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

If you load text in from an XML file that is wrapped in CDATA tags using 'XML.ignoreWhitespace = true' does not work. This function removes the tabs and linebreaks. To have linebreaks use '' tags.


Copy this code and paste it in your HTML
  1. private function removeTabsAndNewLines($str:String):String
  2. {
  3. var rex:RegExp = /(\t|\n|\r)/gi;
  4. $str = $str.replace(rex,'');
  5. return $str;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.