判断字符长度,C语言中文占用两个字节,web前段需要适配后台两个字节

function getByteLength(sValue)
{
return sValue.replace(/[^\x00-\xd6\xd8-\xff]/g,"**").length;
}

posted @ 2022-04-27 15:50  Math点PI  阅读(37)  评论(0)    收藏  举报