functiongetByteLength(str) { var result = ""; var flag = false; var len = 0; var length = 0; var length2 = 0; for (var i = 0; i < str.length; i++) { var code = str.codePointAt(i).toString(16); if (code.length > 4) { i++; if ((i + 1) < str.length) { flag = str.codePointAt(i + 1).toString(16) == "200d"; } }
if (flag) { len += getByteByHex(code); if (i == str.length - 1) { length += len; } } else { if (len != 0) { length += len; length += getByteByHex(code); len = 0; continue; } length += getByteByHex(code); } } return length; }