From c49babb9a12d527d1ab13b489a37b7fc7eb1a9f3 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Sun, 30 Apr 2023 19:57:17 -0500 Subject: [PATCH] Let's try mozilla's fixedCharAt function --- commands/drawDesign.cjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/drawDesign.cjs b/commands/drawDesign.cjs index 79a0004..8f00368 100644 --- a/commands/drawDesign.cjs +++ b/commands/drawDesign.cjs @@ -214,13 +214,14 @@ const surrogatePairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var charIterateState; function charIterate(input) { let stringLength = (input.length - 1); - console.log(surrogatePairs.exec(input)); - console.log(surrogatePairs.lastIndex); + let temp = input.toCharArray(); for (let i = 0; i < stringLength; ++i) { - if (false) { + let compareString = temp.join(""); + if (surrogatePairs.exec(input).index == i) { stringLength--; console.log("Decreasing stringLength variable to", stringLength); } + temp.shift(); } if (charIterateState == undefined) { console.log("undefined! setting to zero");