Skip to main content
Participating Frequently
July 11, 2023
Question

Making the numbers All Caps instead of the letters

  • July 11, 2023
  • 1 reply
  • 202 views

How do I make the numbers inside the textbox All Caps() instead of the letters.

 

Working code:

 

txt = thisLayer.text.sourceText;
hasNumbers = /\d/.test(txt);

if (hasNumbers) {
txt.toUpperCase();
} else {
txt;
}

 

Thanks

This topic has been closed for replies.

1 reply

Mylenium
Legend
July 11, 2023

Your code doesn't make much sense. You're not actually invoking a string substitution with .replace() anywhere. You're just testing a regular expression for true or false. Either uesregex.replace() on your numerals or funnel the captured regex filter through a JS replace. additionally you will of course need to deal with the rest of the string and slice & dice it, then re-assemble with the changed numbers.

 

Mylenium

nickpua2Author
Participating Frequently
July 11, 2023

Thanks Mylenium, Im kinda new to this so im just using what I can find online. can you teach me how to write this?

nickpua2Author
Participating Frequently
July 11, 2023

txt = thisLayer.text.sourceText;
hasNumbers = /\d/.test(txt);

if (hasNumbers) {
hasNumbers.uesregex.replace();
} else {
txt;
}