UCRight (open)

Returns the right part of a UTF-8 string.

Syntax

// Core function, no LOADLIB necessary

STRING FUNCTION UCRight(STRING text, INTEGER numchars)

Parameters

STRING text

String to return a part from

INTEGER numchars

Number of characters (not bytes!) to return

Return value

STRING

The requested part of the string

Description

Right returns the last 'n' characters from a string. If a string contains less than the requested number of characters, the entire string is returned.

Examples

// returns 'ef'
STRING example1 := UCRight("abcdef", 2);

// returns 'euro€'
STRING example2 := UCRight("euro€", 5);

// returns 'ro€'
STRING example3 := Right("euro€", 5);

// returns the entire string, e.g 'abcdef'
STRING example4 := UCRight("abcdef", 100);

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