ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How can I get the number of word in a text layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Curry
How can I get the number of word in a text layer?
on Apr 19, 2017 at 7:00:14 am

Hey there,

Currently, I can count characters with this:

myText = text.sourceText;
myText.length


What I really need is a way to count the number of words within a text layer.

Is this possible?

Thanks in advance! :-)


Return to posts index

Dan Ebberts
Re: How can I get the number of word in a text layer?
on Apr 19, 2017 at 3:59:13 pm

If the words are separated by a single space, this should work:

myText = text.sourceText;
myText.split(" ").length


Dan



Return to posts index

Chris Curry
Re: How can I get the number of word in a text layer?
on Apr 19, 2017 at 8:51:24 pm

Perfect, thank you!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]