Classic JavaScript method: Take a string length (including Chinese)

zhaozj2021-02-16  57

Function string_getlength (str) {

VAR I, RT = 0;

For (i = 0; i

{

RT ;

IF (str.charcodeat (i)> 256) RT ;

}

Return RT;

}

转载请注明原文地址:https://www.9cbs.com/read-18066.html

New Post(0)