LEN function Syntax: LEN(string-argument) Discussion: The LEN function returns the current number of characters that are currently stored in the string-argument, regardless of the defined length of the string-argument. The value returned by the LEN function is called the "current length" of the string-argument. Bold text The current length may be different than the defined length depending on how the field was filled. If the field was filled from the keyboard, and if blanks were stripped from the field at input time, the current length will be less than or equal to the defined length. But, if the field was filled from a data file (where there is no blank stripping), the current length will equal the defined length.
The string-argument may be a string constant, a single-element string variable, a string array element, a string expression, or a string function.
Note: If the string-argument is a string variable, the length of the resultant value may be less than or equal to (but never greater than) the defined length of the string variable.
The intermediate result of the LEN function is stored in a numeric accumulator with a precision of 16.0. If this intermediate result is then moved to a receiving numeric variable, its precision is automatically adjusted to the defined precision of that variable.
Also see LENGTH.
Example: LENGTH 30 & LOCAL A$ . N = LEN(A$)
In the above example, the current length of the string variable A$ is moved to the numeric variable N. A$ is defined with a length of 30 characters, but assume that its current value is "Signature" followed by 21 nulls. In this case N will equal 9.