Searches for the last occurrence of a character in a string.
Kernel.bdh
Strrchr( in sString : string, in nCharacter : number ): string;
String beginning with the last occurrence of the defined character. If the character is not found, the returned string is empty.
Parameter | Description |
---|---|
sString | Defines the string to search in |
nCharacter | Defines the character to search |
dcltrans transaction TStrrchr var sString, sResult : string; nChar : number; begin sString := "Hello world!"; nChar := ord('l'); write("string = "); write(sString); writeln; write("char = "); write(chr(nChar)); writeln; sResult := Strrchr(sString, nChar); write("result = "); write(sResult); writeln; end TStrrchr;
string = Hello world! char = l result = ld!