replace br tags with newline in action script

Posted by Vineela | Uncategorized | Monday 27 October 2008 4:55 am

The below code shows how to format currency string using Action Script


import druva.StringUtils;

trace(StringUtils.br2nl('This is <br>my<br>sample<br>text'));

Have a look at the class


package druva {
	import flash.display.Sprite;

	public class StringUtils extends Sprite {
		public function StringUtils() {
		}

		public static function br2nl(str:String):String {
       		return str.split( "<br>" ).join( '\n' );
		}		

	}
}