题解 | #获取字符串的长度#
获取字符串的长度
http://www.nowcoder.com/practice/e436bbc408744b73b69a8925fac26efc
function strLength(s, bUnicode255For1) { let l = s.length if(!bUnicode255For1) { for(let i in s) { s.charCodeAt(i) > 255 ? l++ : l } } return l }
获取字符串的长度
http://www.nowcoder.com/practice/e436bbc408744b73b69a8925fac26efc
function strLength(s, bUnicode255For1) { let l = s.length if(!bUnicode255For1) { for(let i in s) { s.charCodeAt(i) > 255 ? l++ : l } } return l }
相关推荐