ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Count number of characters before a Line break or space

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nawaz Alamgir
Count number of characters before a Line break or space
on Apr 3, 2018 at 2:40:48 pm
Last Edited By Nawaz Alamgir on Apr 3, 2018 at 5:00:34 pm

Hi, Been using this forum for over 15 years and this is my first post as I have not been able to figure this out

I would like an expression that counts the number of characters in a source text box before a line break or space

So if I wrote

"Coming
Soon" the return value should be 6

or if i wrote

"THIS
SUMMER" will return 4

Thank you!


Return to posts index

Kalleheikki Kannisto
Re: Count number of characters before a Line break or space
on Apr 3, 2018 at 5:12:05 pm

This gives you the character count in the first word of the sentence.

thisComp.layer("My text").text.sourceText.split(/\s/)[0].length

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Nawaz Alamgir
Re: Count number of characters before a Line break or space
on Apr 3, 2018 at 6:02:55 pm

Thank you so much, I was close, just needed that [0] bit

thanks again


Return to posts index

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