ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

"Source Text" expression - Ignore first word of source text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dario De Angelis
"Source Text" expression - Ignore first word of source text
on Oct 8, 2017 at 1:40:58 pm

Hi, guys
i was wondering if there is one expression that allow me to ignore the first world from a source text. I try to explain:

I'm working on a lower third for my youtube channel;
So now, I have 2 lower third version; one with NAME and SURNAME and the other only with surname;
I would like to control both of this lower third with only 1 MAIN TEXT CONTROL, and if for the first one is not a problem to link the "SOURCE TEXT" with the TEXT CONTROL, for the second one i've some problem to create an expression that simply ignore the first word (the name) of my TEXT CONTROL's source text and show me only the rest of the text.

Some of you can help me?


Return to posts index

Dario De Angelis
Re: "Source Text" expression - Ignore first word of source text
on Oct 8, 2017 at 2:15:15 pm

Find solution to my problem here:

https://zacklovatt.com/split-sourcetext-from-comp-name/


Return to posts index

Dan Ebberts
Re: "Source Text" expression - Ignore first word of source text
on Oct 8, 2017 at 2:18:56 pm

Maybe this for Source Text:


try{
value.split(" ")[1];
}catch(e){
value;
}



Dan



Return to posts index


Dario De Angelis
Re: "Source Text" expression - Ignore first word of source text
on Oct 8, 2017 at 2:35:58 pm

Thank you Dan;

For now it works better to add

.split(" ")[1]

at the end of my text; so the final expression is:
comp("TEXT").layer("MAIN TEXT CONTROL").text.sourceText.toUpperCase().split(" ")[1]

that for the example MAIN TEXT: "LeBron James" gave me only "James" as result

but now, I have problem with the surname that has more than 1 words as example: "Micheal De Vito"; with this kind of surname the expression gave me only "De" as result but I need to show the full surname "De Vito". How can i fix it?


Return to posts index

Dario De Angelis
Re: "Source Text" expression - Ignore first word of source text
on Oct 8, 2017 at 3:09:04 pm

Found it!


text_array1 = comp("TEXTS").layer("MAIN TEXT CONTROL").text.sourceText.toUpperCase().split(" ");
try
{
text_array1[1]+" "+ text_array1[2];
}
catch(e) {
text_array1[1];
}


Return to posts index

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