Activity › Forums › Adobe After Effects Expressions › Text to number
-
Text to number
Posted by Aaron Stella on February 6, 2009 at 7:21 pmIs there an expression to take the value from a text layer and convert it to a number?
Filip Vandueren replied 17 years, 3 months ago 4 Members · 3 Replies -
3 Replies
-
Dan Ebberts
February 6, 2009 at 7:31 pmThis will give you an integer:
parseInt(thisComp.layer(“text layer”).text.sourceText)
This will give you an floating point:
parseFloat(thisComp.layer(“text layer”).text.sourceText)
Dan
-
Dotan Stern
February 8, 2009 at 7:47 amHow exactly do you use it?
i tried to use it on the source text -
Filip Vandueren
February 8, 2009 at 7:59 amThat would have no effect.
You would be parsing a number contained in the text-layer, but outputting it again to the textlayer: it would again be a string.
This is only useful if you have a number in the text that you want to use in another expression.
The syntax is self-explanatory I’d think.
Reply to this Discussion! Login or Sign Up