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 including any trailing spaces.

 

 

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.