|
|
|
@ -213,15 +213,18 @@ function design4(input) {
|
|
|
|
|
const surrogatePairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
|
|
|
var charIterateState;
|
|
|
|
|
function charIterate(input) {
|
|
|
|
|
let stringLength = (input.length - 1);
|
|
|
|
|
for (let i = 0; i < stringLength; ++i) {
|
|
|
|
|
if (surrogatePairs.exec(input.charCodeAt(charIterateState)) !== null) {
|
|
|
|
|
stringLength--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (charIterateState == undefined) {
|
|
|
|
|
console.log("undefined! setting to zero");
|
|
|
|
|
charIterateState = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if (charIterateState < (input.length - 1)) {
|
|
|
|
|
if (charIterateState < stringLength) {
|
|
|
|
|
charIterateState++;
|
|
|
|
|
if (surrogatePairs.exec(input.charCodeAt(charIterateState)) !== null) {
|
|
|
|
|
//charIterateState++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
charIterateState = 0;
|
|
|
|
|
}
|
|
|
|
|