CRE Programmer's Guide
String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
8-21
Strlen
stop_chars
is a pointer to a string containing the characters to scan for in str.
Return Value
The Strcspn functions return the number of bytes scanned at the beginning of str
before a character in
stop_chars was encountered. If no characters from
stop_chars are found in str, the length of str is returned.
Considerations
Both str and stop_chars must be terminated by a zero (null) byte to stop the scan.
Example
INT count;
STRING .s[0:19] := ["Next token, please",0];
STRING .tar[0:3] := [";,:",0];
count := RTL_Strcspn_(s, tar); ! count gets 10
Strlen
The Strlen functions return the length of a string.
str
is a pointer to the string.
Return Value
The Strlen functions return the length of str in bytes.
Considerations
•
str must be terminated by a zero (null) byte to stop the scan.
•
The value returned does not include the null character at the end of str.
Example
INT i;
STRING .s[0:7] := ["1234567",0];
INT PROC RTL_Strlen_( str );
STRING .str; ! in TNS only
INT(32) PROC RTL_StrlenX_( str );
STRING .EXT str; ! in TNS only