Len function (LotusScript® Language)

Returns the number of characters in a string, or the number of bytes used to hold a numeric value.

Syntax

Len ( { stringExpr | variantExpr | numericExpr | typeName } )

Elements

stringExpr

Any string expression.

variantExpr

Any Variant expression that includes a variable name.

numericExpr

The name of a variable, an element of an array, an element of a list, or a member variable of a user-defined data type or class. The data type of numericExpr is numeric.

typeName

An instance of a user-defined data type. It can be a simple variable of that data type, or an element of an array variable or a list variable of that data type.

Return value

For stringExpr, Len returns the number of characters in the string expression.

For variantExpr, Len returns the number of characters required to hold the value of variantExpr converted to a String.

For numericExpr, Len returns the number of bytes required to hold the contents of numericExpr.

For typeName, Len returns the number of bytes required to hold the contents of all the member variables, unless the user-defined data type includes Variant or variable-length String members. In that case, the length of the variable of the user-defined data type may not be the same as the sum of the lengths of its member variables.

Usage

In LotusScript® Release 3 and after, Len(NULL) generates an error. In previous releases of LotusScript®, Len(NULL) returned NULL.

Len(v), where v is EMPTY, returns 0.

To determine the length of a string in bytes rather than in characters, use the LenB function. To determine the length of a string in bytes in the platform-native character set, use the LenBP function.

Example