Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > LEN_UTF8

Purpose

Counts the number of UTF-8 characters in a string.

Syntax

#LengthOrError = LEN_UTF8(String-Expression)

Operation

Returns minus one if the string contains invalid UTF-8. Otherwise it is the number of UTF-8 characters in the argument. The first argument is a string expression and may contains UTF-8 characters.

Remarks

UTF-8 characters may be one, two, three or four bytes in length.

Example

#Length = LEN_UTF8($A + $B + $C)

if #Length >= 0 then

  umsg("$Length =" + CONV(#Length), -1)

else

  umsg("LEN_UTF8 failed - invalid UTF-8?", -1)

endif

Comment on this topic

Topic ID: 520331