Searches for the first occurrence of a character in a string.
Kernel.bdh
Strchr( in sString : string, in nCharacter : number ): string;
String beginning with the first 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 TStrchr var sString, sPart : string; nChar : number; begin sString := "Hello world!"; nChar := ord('w'); write("string = "); write(sString); writeln; write("char = "); write(chr(nChar)); writeln; sPart := Strchr(sString, nChar); write("part = "); write(sPart); writeln; end TStrchr;
string = Hello world! char = w part = world!