内容大于2换行展示

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;
}

 

posted @ 2023-01-10 16:44  保洁叔叔  阅读(13)  评论(0编辑  收藏  举报