Page 1 of 1
Expression that counts characters in text needed

Posted:
Tue Dec 28, 2021 5:30 pm
by banana
Hi there,
is there an expression that gives be the number of characters of a text as an output?
Like this
Text: Hello
Output: 5
Thanks
Klaus
Re: Expression that counts characters in text needed

Posted:
Tue Dec 28, 2021 7:07 pm
by xunile
You can use the following expression to find and display the length of the text in the Text1 node.
- Code: Select all
string.len(Text1.StyledText.Value)
Re: Expression that counts characters in text needed

Posted:
Wed Dec 29, 2021 9:11 pm
by banana
Well, this works straight away. Thank you very much, xunile <3
Re: Expression that counts characters in text needed

Posted:
Thu Dec 30, 2021 11:20 pm
by roger.magnusson
For non-english users, the issue with the version of Lua that's used in Fusion and Resolve is that it doesn't support extended character encodings, like UTF-8.
That means functions like len will report a single UTF-8 character as being twice the length. Try it with 'Ö' for example.