发布于 4年前

JS 获取字符串行数

 let str = `第一行,
第二行,
第三行,
第四行`

let len = str.split('\n').length

console.log(len) // 4
©2020 edoou.com   京ICP备16001874号-3