<script>
let text = "我今天起床比较早,因为我要去吃早饭";
let resultText = "";
let step = 6;
let length = XEUtils.ceil(text.length / step, 0);
for (let i = 0; i < length; i++) {
resultText += i === length - 1 ? text.substr(i * (step), step) : text.substr(i * (step), step) + "<br>";
}
</script>
网友评论