Copy link to clipboard
Copied
How to check if a character is a nonbreaking space in UXP?
if (chars[chars.indexOf(char) - 1].contents === " ") {
console.log("yes");
}
I can't use \u00A0 or /~S/. The first one doesn't work, the second can't be used in .jsx UXP.
What about using 160 but the hex is \x{00A0}
Also found this https://developer.adobe.com/indesign/dom/api/s/SpecialCharacters/#:~:text=NONBREAKING_SPACE%20%3D%201397645907
Thank You for help.
Correct answer is
if (myCharacter.contents.toString() === "NONBREAKING_SPACE")
Thank You for help.
Correct answer isif (myCharacter.contents.toString() === "NONBREAKING_SPACE")
By @mateuszp13156491
You can save time on converting to string and just compare numeric value:
if (myCharacter.contents === 1397645907)
{
alert("Non Breaking Space")
};
Copy link to clipboard
Copied
What about using 160 but the hex is \x{00A0}
Also found this https://developer.adobe.com/indesign/dom/api/s/SpecialCharacters/#:~:text=NONBREAKING_SPACE%20%3D%20...
Copy link to clipboard
Copied
Thank You for help.
Correct answer is
if (myCharacter.contents.toString() === "NONBREAKING_SPACE")
Copy link to clipboard
Copied
Thank You for help.
Correct answer isif (myCharacter.contents.toString() === "NONBREAKING_SPACE")
By @mateuszp13156491
You can save time on converting to string and just compare numeric value:
if (myCharacter.contents === 1397645907)
{
alert("Non Breaking Space")
};
Find more inspiration, events, and resources on the new Adobe Community
Explore Now