-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
const stringByteLength = (string) => {
let byte = 0;
for (let i = 0; i < string.length; i++) {
const char = string.charCodeAt(i);
if (char >> 11) {
byte += 3;
} else if (char >> 7) {
byte += 2;
} else {
byte += 1;
}
}
console.log(byte);
return byte;
};(c == 10 ) ? 2 : (( c >> 7 ) ? 2 : 1))Metadata
Metadata
Assignees
Labels
No labels