Length Command
Obsolete
This command is replaced by the Length function.
Purpose
To move the number of characters in a value to a variable.
Syntax
length
value
to
variable
What It Does
The length command counts the number of characters, including embedded spaces, in value and puts the result in variable.
The way it deals with leading and trailing spaces varies according to the class of value:
- For database fields,
lengthreturns the defined length of the field. - For constants,
lengthreturns all characters, including all spaces, between the quotation marks. - For windows,
lengthreturns all characters, including leading spaces, except for trailing spaces. - For variables,
lengthreturns whatever was moved to the variable (see rules above for the possible sources of data in any variable).lengthdoes not return the defined length of the variable unless it is full of characters, as all String type variables are immediately after being declared (they are full of spaces).
Example
string riches
number digits
move "great, vast " to riches
length riches to digits
In this example, the string "great, vast " (with one trailing space) is moved to the String-type variable riches. The length command would put a value of 12 into digits.
Notes
- Although
lengthcan be used on Date-, Integer-, and Number-type variables, it is typically used on String-type variables.