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

Add percentage symbol % to text

Community Beginner ,
Aug 11, 2022 Aug 11, 2022

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
4.5K
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

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) + "%";

 

 

Translate
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) + "%";

 

 

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

Awesome, thanks a million!

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