Length (open)

Returns the length of an variable.

Syntax

// Core function, no LOADLIB necessary

INTEGER FUNCTION Length(VARIANT obj)

Parameters

VARIANT obj

The variable whose length should be measured.

Return value

INTEGER

The function returns the number of bytes in the STRING, number of elements in the ARRAY or the length of a BLOB in bytes.

Description

This function returns the length of an variable. The variable can be of a STRING, BLOB or any ARRAY type. Its unit of measurement depends on the type of the variable.

Examples

// returns 6
INTEGER example1 := Length("abcdef");

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

// returns 6 (the euro character is one character in UNICODE(UTF-8))
INTEGER example2 := UCLength("€ 2,50");

// returns 4
INTEGER ARRAY intarray := [1, 2, 3, 4];
INTEGER example3 := Length(intarray);