Strpbrk Function

Action

Searches for the first occurrence of any one character out of a defined set of characters in a string.

Include file

Kernel.bdh

Syntax

Strpbrk( in sString       : string,
         in sCharacterSet : string ): string;

Return value

the shortened string, beginning with a character defined in sCharacterSet

Parameter Description
sString Identifies the string to search in
sCharacterSet Defines a set of characters and the search criteria

Example

dcltrans
  transaction TStrpbrk
  var
    sString, sSet, sResult1, sResult2: string;
  begin
    sString := "Hello world!";
    sSet := "lwx";
    write("string  = "); write(sString); writeln;
    write("set     = "); write(sSet); writeln;

    sResult1 := Strpbrk(sString, sSet);
    sResult2 := Strpbrk(sString[5], sSet);
    write("result1 = "); write(sResult1); writeln;
    write("result2 = "); write(sResult2); writeln;
  end TStrpbrk;

Output

string  = Hello world!
set     = lwx
result1 = llo world!
result2 = world!