Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Select specified character (example:second character) in a Text

  • Select specified character (example:second character) in a Text

    Posted by Aimee Brown on September 4, 2019 at 7:54 am

    I would like to be able to select a specified character in a text layer.
    It’s just for a simple if/else expression, but I don’t know how to pick out specific characters

    Thanks!

    if (thisComp.layer("Text 1").text.sourceText(index-1) == "e")
    100
    else
    0

    Aimee Brown replied 7 years ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    September 4, 2019 at 11:04 am

    myIndex = 3;
    if (thisComp.layer(“Text 1”).text.sourceText.split(“”)[myIndex-1] == “e”)
    100
    else
    0

    Andrei
    My Envato portfolio.

  • Aimee Brown

    September 4, 2019 at 11:10 am

    Thanks.
    I couldn’t find my post after I posted it, and I found a different solution. This is more what I was looking for (in case anyone else has the same query).

    if (thisComp.layer(“Text 1”).text.sourceText[1] == “e”)
    100
    else
    0

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy