欢迎访问我的博客,目前从事Machine Learning,欢迎交流

js操作文章、字符串换行

操作前:

 

操作后:

 

 

第一步:

把中英文的逗号和顿号置换为 '\n’

support_unit = support_unit.replace(/,|,|、/g, '\n')
 
第二步:
 //为了使\n生效
    white-space: pre;

 

参考:https://blog.csdn.net/ccmedu/article/details/82021065

posted @ 2019-04-24 18:26  有蚊子  阅读(1792)  评论(0编辑  收藏  举报