The LEN function is designed to return the length of a string expression.
Format
LEN(expr) |
Parameter(s)
expr |
An expression evaluating to a string whose length is returned. |
Description
The LEN function reports the number of characters in a string. All blank spaces (including trailing blanks) are included in the calculation.
Example
To assign the variable LENGTH with the number of characters in the string STRING, the code would read:
LENGTH = LEN(STRING) |
If STRING contains "HI, MOM", LENGTH contains 7. In the next application the NAMES string contains a list of names separated by commas (,). To replace a name, the substring assignment statement is used, but the LEN function is necessary to return the length of the field to be replaced.
CURR.NAME = FIELD( NAMES, ",", 2) IF NEW.NAME <> "" THEN BEG.COL = COL1( ) + 1 LENGTH = LEN( CURR.NAME ) NAMES[ BEG.COL, LENGTH ] = NEW.NAME END |
See Also