Forum Replies Created

  • Olga Povarchuk

    December 18, 2015 at 11:11 pm in reply to: Create Line Break After X Number of Characters

    Hi Dan or anyone else that can help,

    I tried this expression in my own project and it works pretty well.. I modified it to create a line break after the 10th character. Only problem is it disables right when it hits character 10. At 9 it’s fine, at 11 it’s fine, but at 10 in doesn’t seem to know what to do.

    Doing my best to figure it out but unfortunately I’m relatively new to this and my debugging abilities are limited. Hopefully it’s a simple fix. Any help would be greatly appreciated!

    Olga

    txt = comp("EDIT_THIS_COMP").layer("Text").text.sourceText;
    if (comp("EDIT_THIS_COMP").layer("Text").text.sourceText.length >= 10){
    for (i = 10; i > 0; i--) if (txt[i] == " ") break;
    if (i > 0)
    txt.substr(0,i) + "\r" + txt.substr(i+1)
    else
    txt.substring(0,10) + "\r" + txt.substring(11,999);
    }else{
    txt
    }

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