0.0.9 • Published 4 years ago
lq-util v0.0.9
lq-util v0.0.9
Methods
getByteLength
Methods
获取字符串字节长度
Arguments
str
(string): 需要获取字节数的字符串
Returns
(number): 返回字符串字节长度
Example
getByteLength('hello world')
// => 11
getByteLength('你好')
// => 4
getByteLength(' ')
// => 2
getByteLength('你好 world')
// => 10
getByteLength({})
// -1
getByteLength(9527)
// -1