判断字符长度,C语言中文占用两个字节,web前段需要适配后台两个字节
function getByteLength(sValue)
{
return sValue.replace(/[^\x00-\xd6\xd8-\xff]/g,"**").length;
}
本文来自博客园,作者:Math点PI,个性签名:“不写bug怎么进步?”,转载请注明原文链接:https://www.cnblogs.com/MrZhous/p/16199287.html
function getByteLength(sValue)
{
return sValue.replace(/[^\x00-\xd6\xd8-\xff]/g,"**").length;
}
本文来自博客园,作者:Math点PI,个性签名:“不写bug怎么进步?”,转载请注明原文链接:https://www.cnblogs.com/MrZhous/p/16199287.html