首页 > 其他分享 >内容大于2换行展示

内容大于2换行展示

时间:2023-01-10 16:57:01浏览次数:32  
标签:展示 换行 value substring length textCount let 大于 newValue

function(value) {
       let newValue = "";
       for(var i = 0 ; i < value.length; i++){
            let textCount = 2;
            if(i%textCount == 0){
                    newValue += value.substring(i,i+textCount) + "\n";
            }
            if(i == value.length - 1 && i % textCount != 0){
                    newValue += value.substring(i,value.length);
            }
       }
       return newValue;
}

 

标签:展示,换行,value,substring,length,textCount,let,大于,newValue
From: https://www.cnblogs.com/webway/p/17040740.html

相关文章