开发者

remove multi-lines in text

开发者 https://www.devze.com 2023-01-29 11:34 出处:网络
How do I r开发者_JS百科emove line 1,2,3 and retain line 4? Like: Programmer Business Owner Manager Marketer

How do I r开发者_JS百科emove line 1,2,3 and retain line 4?

Like:

  1. Programmer
  2. Business Owner
  3. Manager
  4. Marketer


you can split on linebreaks (\r and \n), then grab the last element:

textfield.text = textfield.text.split(/[\r\n]/gm).pop();
0

精彩评论

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

关注公众号