Xbasic

LEN Function

Syntax

Length as N = LEN(string as C)

Arguments

stringCharacter

A string of characters.

Returns

LengthNumeric

Returns the length of the string. A blank or uninitialized string returns a length of 0.

Description

Returns the number of characters in a string.

Discussion

LEN() returns the length of the character string. The length of an empty or uninitialized character string is 0.

Example

dim firstname as c = " Steve         "

? len(firstname)
= 15

' trim trailing whitespace
? len(trim(firstname))
= 6

' trim leading whitespace
? len(ltrim(firstname))
= 14

' trim all whitespace
? len(alltrim(firstname))
= 5

See Also