LEN function

Syntax

LEN (string)

Description

Use the LEN function to return the number of characters in string. Calculations are based on character length rather than display length.

string must be a string value. The characters in string are counted, and the count is returned.

The LEN function includes all blank spaces, including trailing blanks, in the calculation.

If string evaluates to the null value, 0 is returned.

If NLS is enabled, use the LENDP function to return the length of a string in display positions rather than character length.

Example

P="PORTLAND, OREGON"
PRINT "LEN(P)= ",LEN(P)
*
NUMBER=123456789
PRINT "LENGTH OF NUMBER IS ",LEN(NUMBER)

This is the program output:

LEN(P)=  16
LENGTH OF NUMBER IS          9