javascript - I have a question about js merging?
迷茫
迷茫 2017-06-26 10:54:37
0
4
720

I have this one
2|3|4|3|3|2,|3,|2|3,|4,|2|3|3|2|3|2
I want to merge the data with commas like this
2|3|4|3|3|2,3|2|3,4|2|3|3|2|3| 2
Is there any good way?
If there are three or four adjacent, how can I change it? Newbies don’t quite understand! Please answer!

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all (4)
Peter_Zhu

,|replaced with,

    typecho

    str.replace(',|',',')

      为情所困
      问题不是很详细,只是两个相邻并且都有逗号才合并吗? var str = '2|3|4|3|3|2,|3,|2|3,|4,|2|3|3|2|3|2'; var arr = str.split('|'); for(let i=0;i
        给我你的怀抱

        Help you implement it with code.

            
        
          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!