In flex, how to remove empty lines in text area?
In fle开发者_StackOverflow社区x, how to remove empty lines in text area?
Assuming you mean unwanted blank lines created by gratuitous carriage returns, here's one way. I made it verbose for clarity, but you could reduce it to a single line if you wanted.
private function stripLinesFromTextArea (textArea:TextArea) : void {
var txt:String = textArea.text;
var re:RegExp = /\n+/g;
txt = txt.replace(re,"\n");
textArea.text = txt;
}
精彩评论