CRE Programmer's Guide

String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
8-26
Strrchr
Example
STRING .s[0:100] := ["800-555-1212",0];
STRING .tar[0:100] := [" -;,.",0];
STRING .char_ptr;
! @char_ptr gets @s[3]
@char_ptr := RTL_Strpbrk_(s, tar);
Strrchr
The Strrchr functions scan a string backwards for the last occurrence of a specified
character.
str
is a pointer to the string to scan.
char
is the character to search for. Only bits <8:15> of char are used for the search
character.
Return Value
The Strrchr functions return the address of the last occurrence in str of char. If str
does not contain
char, zero is returned.
Considerations
str must be terminated by a zero (null) byte to stop the scan. The terminating zero
byte must be at the right end of the buffer.
Example
STRING .s[0:100] := ["This is an example",0];
STRING .char_ptr;
! @char_ptr gets @s[13]
@char_ptr := RTL_Strrchr_(s, "a");
INT PROC RTL_Strrchr_( str, char );
STRING .str; ! in
INT char; ! in TNS only
INT(32) PROC RTL_StrrchrX_( str, char );
STRING .EXT str; ! in
INT char; ! in TNS only