开发者

In flex, how to remove empty lines in text area?

开发者 https://www.devze.com 2023-01-14 20:09 出处:网络
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, b

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

精彩评论

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