-
Expression to clamp the text length and add “…” to the end if over value
Hey guys, I’m working on a project that will take input from various users for the same project. Some of these users may use text that will extend beyond the visual bounds of the text field, and I’d like to stop it from moving/scaling beyond that field, and also add “…” to the end to keep it visually appealing. Automatic scaling with sourceRecAtTime is not an option here. Here’s the expression I’ve used so far on the Source Text Property:
text.sourceText.substr(0,36);
if (text.sourceText.length >= 35){
text.sourceText + “…”;};
It adds the ellipsis where it should be, but doesn’t clamp the text length. I’m stumped. Any ideas?