I have a few text layers which need to take their source text from the comp name, it just makes my job easier as I need to replicate the action several times.
One of the texts is too long and doesn't fit in one line so I'm trying to break it automatically using the expression below.
The expression is not returning any errors but it's not breaking the text either.
My guess is that it's missing the bottom part of the expression: "else" and then something
but I have no idea how to instruct the expression to not break the line.
It's kind of reversing the function by specifying a max amount of characters per line; the original expression I was trying to use divided the number of characters and if the result was 0 then it would break the line (or at least that's what I tried). Yours is a much more straightforward solution.
I'm reading now who substr() works, on your website. I never used it before.