0.0.5 • Published 4 years ago
lq-uitls v0.0.5
test-tools v0.0.4
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