npm.io
0.0.9 • Published 6 years ago

lq-util

Licence
ISC
Version
0.0.9
Deps
5
Size
4 kB
Vulns
0
Weekly
0

lq-util v0.0.9

Methods

Methods

getByteLength(str)

获取字符串字节长度

Arguments
  1. str (string): 需要获取字节数的字符串
Returns

(number): 返回字符串字节长度

Example
getByteLength('hello world')
// => 11

getByteLength('你好')
// => 4

getByteLength('  ')
// => 2

getByteLength('你好 world')
// => 10

getByteLength({})
// -1

getByteLength(9527)
// -1

Keywords