-
Insert Line Break every X number of characters
I found this great expression by Dan Ebberts and Bryce Poole in the following post which creates a line break after a certain amount of characters:
https://forums.creativecow.net/thread/227/27641I was trying to modify it so it could continue to insert line breaks after X amount of characters instead of just the first time. For example, after every 20th character, insert a line break, essentially creating a bounding box via expressions with multiple lines of text each being 20 characters long. I know a little bit of expressions, but haven’t really messed with loops so I was wondering if anyone could help. Thanks!
txt = value;
if (thisComp.layer("Overlay TXT Here").text.sourceText.length >= 61){
for (i = 61; i > 0; i--) if (txt[i] == " ") break;
if (i > 0)
txt.substr(0,i) + "\r" + txt.substr(i+1)
else
txt.substring(0,61) + "\r" + txt.substring(62,999);
}else{
txt
}