length()
The strLib.length()system function returns the number of characters in the string.
Syntax
strLib.length(
target STRING | CHAR | DBCHAR | MBCHAR | UNICODE In,
returns (result INT)
- target
-
Input can be any value that is assignment compatible with any of the above types.
- result
-
It returns an int representing the number of characters in the string. This integer value indicates the length of the string.
Example
function main()
myString String = “Customer”;
myChar Char(8) = “Customer”;
myDbChar DbChar(8) = “Customer”;
sysLib.writeStdout(“‘myStr’ length is : “+ strLib.length(myStr));
sysLib.writeStdout(“‘myChar’ length is : “+ strLib.length(myChar));
sysLib.writeStdout(“‘myDbChar’ length is : “+ strLib.length(myDbChar));
end
Theoutput is as follows:
’myStr’ length is: 8
‘myChar’ length is: 8
‘myDbChar’ length is: 8