// Function const getByteLengthOfString = function (s, b, i, c) { for (b = i = 0; (c = s.charCodeAt(i++)); b += c >> 11 ? 3 : c >> 7 ? 2 : 1); return b; };
// Function String.prototype.getBytes = function () { const contents = this; let str_character; let int_char_count = 0; let int_contents_length = contents.length;
for (k = 0; k < int_contents_length; k++) { str_character = contents.charAt(k); if (escape(str_character).length > 4) int_char_count += 2; else int_char_count++; }
// Function String.prototype.getStringFromByteLength = function (length) { const contents = this; let str_character; let int_char_count = 0; let int_contents_length = contents.length;
let returnValue = '';
for (k = 0; k < int_contents_length; k++) { str_character = contents.charAt(k); if (escape(str_character).length > 4) int_char_count += 2; else int_char_count++;