_getByteLen(v) { var len = 0; for (var i = 0; i < v.length; i++) { var a = v.charAt(i); if (a.match(/[^x00-xff]/ig) != null) { len += 2; } else { len += 1; } } return len; }
摘自:https://blog.csdn.net/qq_31393401/article/details/81978543
_getByteLen(v) { var len = 0; for (var i = 0; i < v.length; i++) { var a = v.charAt(i); if (a.match(/[^x00-xff]/ig) != null) { len += 2; } else { len += 1; } } return len; }
摘自:https://blog.csdn.net/qq_31393401/article/details/81978543