The built-in length functions STRLEN and XSTRLENdetermine the length of a character string up to the next character that is not a space.
[COMPUTE] n = STRLEN( c ).
STRLENprocesses any operand c as a character data type, regardless of its real type. There is no type conversion.
As with mathematical functions , the keyword COMPUTE is optional.
For more information, refer to the keyword documentation.
DATA: int TYPE i, word1(20) TYPE c VALUE '12345'. word2(20) TYPE c. word3(20) TYPE c VALUE ' 4 '.
int = strlen( word1 ).WRITE int.
int = strlen( word2 ).WRITE / int.
int = strlen( word3 ).WRITE / int.
The results are 5, 0, and 4respectively.