lq-util
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i lq-util

Weekly Downloads

1

Version

0.0.9

License

ISC

Unpacked Size

3.82 kB

Total Files

4

Last publish

Collaborators

  • a327921510