UCLength (open)

Returns number of characters in a UNICODE(UTF-8) string

Syntax

// Core function, no LOADLIB necessary

INTEGER FUNCTION UCLength(STRING text)

Parameters

STRING text

The string which length should be measured

Return value

INTEGER

Returns the number of characters in a UNICODE(UTF-8) string

Description

This function returns the length of a possibly UTF-8 encoded string in characters, as opposed to the Length function which returns the number of bytes

Examples

// returns 6 (the euro consists of one UTF-8 character)
INTEGER len_chars := UCLength("€ 2,50");

// returns 8 (the euro consists of three bytes)
INTEGER len_bytes := Length("€ 2,50");