-
Detecting specific character in a text layer
Hi everyone,
I’ve been roaming around creative cow for a while, always finding answers to my questions withour ever posting a question… But not this time!
I’m building a ToolKit for a TV Station. I’m working on a billboard where they just have to input the name of their shows, the times and then render the billboard.
The problem is, some shows have subtitles, some are long and require 2 lines of text and some are short ands should be on one line only. So I’ve created a precomp for each specific case.
I’ve made this little script so that when they input a “*”, it substitutes with a “/r” so the title is on two lines :
txt=comp(“1. TEXTE”).layer(“EMISSION1_TITRE”).text.sourceText;
txt.replace(“*”,”r”);In the appropriate composition’s opacity, I’d like to put an expression saying “if you detect the ‘*’, opacity should be 0%”
Since I’m not that familiar with all the expressions out there, my skills are rather basic. I’ve been trying to create a variable from stuff I’ve found on the web like :
Detect=comp(“1. TEXTE”).layer(“EMISSION1_TITRE”).text.sourceText.characterValue;
or
Detect=comp(“1. TEXTE”).layer(“EMISSION1_TITRE”).text.sourceText.indexOf(“*”);
But this doesn’t seem to work, or I don’t know how to make it work.
Any help on this would be great!
Thanks