Programmers with PHP background may miss some great functions that would make programmers life much easier (nl2br in PHP). Working with HTML in Flex is a big task and as you found in the previous article more functions are needed to process HTML strings.
In this article a simple function will transform any new line to a <br> tag.
public function nl2br(str:String):String { return str.replace(new RegExp("[\n\r]","g"),"<br>"); }
Very simple. Just a single RegExp.
Popularity: 57%
| ||
|
Tags: ActionScript, HTML, nl2br
This post was written by Andrei Ionescu
Views: 1411


















