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

Making the numbers All Caps instead of the letters

New Here ,
Jul 11, 2023 Jul 11, 2023

Copy link to clipboard

Copied

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

Views

103

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

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

Votes

Translate

Translate

Report

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