Home >Web Front-end >JS Tutorial >JS version to get the real length of the string and the string function to get the fixed length_javascript skills

JS version to get the real length of the string and the string function to get the fixed length_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:15:421239browse

The length of double-byte characters is automatically calculated as 2. When selecting characters, the length of single-byte characters is also taken. For example, 2 takes one Chinese character or two letters, and 1 takes one Chinese character or letter.


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn