开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜