第一个逗号的换行符为40个字符

时间:2017-05-12 13:37:10

标签: jquery join replace

我想用换行符替换40个字符后的每个逗号。

因此,如果脚本传递了40个字符而不是第一个逗号处的换行符。

自:

43 characters, 46 characters, 41 characters, 

致:

 43 characters,
 46 characters,
 41 characters, 

一个例子,字符串:

  FFS Level D Secondary Control, A320 and A330 for Trim Wheel, B737 for Throttles, Nose Wheel Tiller, Speed Brake Handle, FTD, Secondary Control.

要: FFS Level D Secondary Control, A320 and A330 for Trim Wheel, B737 for Throttles, Nose Wheel Tiller, Speed Brake Handle, FTD, Secondary Control.

我目前的代码: application_json.match(/.{1,40}/g).join("<br/>");

0 个答案:

没有答案