$LENGTH (get string length)
$LENGTH acquires the length in bytes of the specified character string.
Syntax
return-value=$LENGTH(character-string)
Values
-
return-value
Specifies the name of the variable into which the acquired character string length is set.
-
character-string
Specifies the character string whose length is to be acquired, either as a constant or an array variable. A constant must be enclosed in single quotation marks ('').
If an array variable is specified, the number of elements set in the array is returned.
Status
The following table lists and describes the possible statuses:
Status |
Description |
---|---|
NORMAL |
Normal end |
NODATA |
— |
ERROR |
— |
Script execution interrupted |
An invalid argument was specified, or an error other than the above occurred. |
Example
The following example acquires and outputs the length of character string string length:
[SET_VALUE] DATA = 'string length' VAL = $LENGTH(DATA) MSG = 'LENGTH = ' + VAL $ECHO(MSG)
- Execution result:
-
LENGTH = 13