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

Add percentage symbol % to text

Community Beginner ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

Hi again guys 🙂

 

I am trying to add '%' to a text linked to a slider.

So, in my 'Source Text' I have the following expression:

effect("Slider Control")("Slider")

 

How can I add '%' at the end of my text? I have tried things like:

(effect("Slider Control")("Slider"))+%

but it does not work... 😞

 

It might be easy I just don't know how to code it.

 

 

Thank you!

TOPICS
Error or problem , Expressions , FAQ

Views

1.6K

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

correct answers 1 Correct answer

Community Expert , Aug 11, 2022 Aug 11, 2022

If you want an expression in a test layer to return the characters you enter, you need to put them in quotes. If you want two decimal points in your number, you need to extract the value from the Slider Control and add toFloor(2). You will end up with something like 24.50%. If you want no decimal points, the expression will look like this:

 

num = effect("Slider Control")("Slider").value;
num.toFixed(0) + "%";

 

 

Votes

Translate

Translate
Community Expert ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

If you want an expression in a test layer to return the characters you enter, you need to put them in quotes. If you want two decimal points in your number, you need to extract the value from the Slider Control and add toFloor(2). You will end up with something like 24.50%. If you want no decimal points, the expression will look like this:

 

num = effect("Slider Control")("Slider").value;
num.toFixed(0) + "%";

 

 

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
Community Beginner ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

LATEST

Awesome, thanks a million!

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