Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions ExtendScript AE: Identifying pieces of a string in an “edittext” box.

  • ExtendScript AE: Identifying pieces of a string in an “edittext” box.

    Posted by Andy Troz on August 8, 2013 at 12:00 am

    This may be a little obscure, but I’m trying to achieve the following:

    var ab = doThis;
    var cd = doThat;

    If a user types a single string of “abcd” into my “edittext” box, is there a way that I can identify the “ab” and “cd” separately?

    Best,
    Andy.

    Dan Ebberts replied 13 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    August 8, 2013 at 12:25 am

    You can use indexOf() to detect the presence of a specific substring within a string. For example:

    if (myText.indexOf(“ab”) > -1) alert(“Found ‘ab'”);

    There may be better ways–it depends on the range of possible formatting of your input text.

    Dan

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