UCSubstring (open)

Returns part of a UTF-8 string.

Syntax

// Core function, no LOADLIB necessary

STRING FUNCTION UCSubstring(STRING text, INTEGER start, INTEGER numchars)

Parameters

STRING text

String to return a part from

INTEGER start

Starting character (not byte!) position

INTEGER numchars

Number of characters (not bytes!) to return

Return value

STRING

The requested part of the string

Description

Substring returns the part of string specified by the start and length parameters.

Examples

// returns 'bcde'
STRING example1 := UCSubstring("abcdef", 1, 4);

// returns '€uro'
STRING example2 := UCSubstring("euro€uro", 4, 4);

// returns '€u'
STRING example3 := Substring("euro€uro", 4, 4);

// returns an empty string
STRING example4 := UCSubstring("abcdef", 100, 100);

// returns an empty string
STRING example5 := UCSubstring("abcdef", -10, -20);