逗号计数等于10后如何换行 [英] How to line break after comma count equal to 10
问题描述
我有以下字符串
见面:2,你:2,那:2,让':2,观看:2,:2,什么: 1,声音:1,pretti:1,好:1,其中:1,应:1,我们:1,at:1,h
ow:1,约:1,subwai:1 ,entranc:1,好吧:1,我会:1,那里:1,一:1,戒指:1,领主:1,:1,某事:1,做:1
但我希望它的断线每个逗号数等于10
见面:2,你:2,那个:2,让':2,观看:2,:2,什么:1,声音:1,蒂米蒂:1,好:1,
其中:1,应该:1,我们:1,在: 1,如何:1,关于:1,subwai:1,entranc:1,好吧:1,我会:1,
那里:1,一:1,响铃:1,主: 1,of:1,someth:1,do:1
我尝试了什么:
$ array_of_strings = str_split($ txtstr,100);
array_of_strings = str_split(
txtstr,100);
爆炸和内爆 [ ^ ]可以迭代地执行操作:
explode
只有十个元素,使用逗号作为分隔符。implode
再次使用逗号作为粘合剂。
I have following string
meet:2,you:2,that:2,let':2,watch:2,the:2,what:1,sound:1,pretti:1,good:1,where:1,should:1,we:1,at:1,h
ow:1,about:1,subwai:1,entranc:1,alright:1,i'll:1,there:1,one:1,ring:1,lord:1,of:1,someth:1,do:1
but I want it break line every comma count is equal to 10
meet:2,you:2,that:2,let':2,watch:2,the:2,what:1,sound:1,pretti:1,good:1,
where:1,should:1,we:1,at:1,how:1,about:1,subwai:1,entranc:1,alright:1,i'll:1,
there:1,one:1,ring:1,lord:1,of:1,someth:1,do:1
What I have tried:
$array_of_strings = str_split($txtstr, 100);
array_of_strings = str_split(
txtstr, 100);
explode and implode[^] would do the trick, iteratively:
explode
just ten elements, using the comma as separator.implode
them again, using the comma as glue.
这篇关于逗号计数等于10后如何换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!