LEN()

LEN(), LENS()

Top  Previous  Next

 

The LEN() function returns the length of a string. The LENS() function is similar to LEN() but operates on successive elements of a dynamic array, returning a similarly structured dynamic array of results.

 

 

Format

 

LEN(string)

 

where

 

stringis the string for which the length is to be returned.

 

 

The LEN() function returns the length of string (number of characters) including any trailing spaces. On ECS mode systems, this may not be the same as the number of screen positions required to display the string as some ECS characters are double width.

 

 

Example

 

LOOP

  DISPLAY "Enter account number: "

  INPUT ACCOUNT.NO

WHILE LEN(ACCOUNT.NO) # 6

  PRINTERR "Invalid account number"

REPEAT

 

This program fragment prompts for and inputs an account number. If it is not six characters in length, an error is displayed and the prompt is repeated.

 

 

See also:

DISPLAY.WIDTH()