LENGTH
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
<Variable> := LENGTH (<String>)
Description
Returns the length of the specified text in <String>.
Diagram
Returned value type
Integer
Parameters
Parameter | Description |
<Variable> | The variable that will be set to the length of the string . |
<String> | An expression giving the string or realstring value to measure the length of. |
Remarks
The string variable <String> can also be represented by a realstring variable an alpha variable or a literal string.
When calculating the length of an alpha variable the leading spaces are counted and the trailing spaces are skipped (see the example below).
Example
var
n-townlength : numeric 2
n-countrylength : numeric 2
n-combinedlength : numeric 2
a-town : alpha 20 value ' Coevorden'
a-country : alpha 20 value 'Netherlands'
begin_routine
n-townlength := length (a-town)
n-countrylength := length (a-country)
n-combinedlength := length (a-town + a-country)
end_routine
// Results:
// n-townlength = 10
// n-countrylength = 11
// n-combinedlength = 21
n-townlength : numeric 2
n-countrylength : numeric 2
n-combinedlength : numeric 2
a-town : alpha 20 value ' Coevorden'
a-country : alpha 20 value 'Netherlands'
begin_routine
n-townlength := length (a-town)
n-countrylength := length (a-country)
n-combinedlength := length (a-town + a-country)
end_routine
// Results:
// n-townlength = 10
// n-countrylength = 11
// n-combinedlength = 21