Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Making the numbers All Caps instead of the letters

New Here ,
Jul 11, 2023 Jul 11, 2023

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

 

Working code:

 

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

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

 

Thanks

TOPICS
How to
161
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2023 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2023 Jul 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2023 Jul 11, 2023
LATEST

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines