Strstr Function

Action

Searches a string for a substring.

Include file

Kernel.bdh

Syntax

Strstr( in sString    : string,
        in sSubString : string ): string;

Return value

sString starting at the first occurrence of sSubString

Parameter Description
sString Defines the string to search in
sSubString Defines the string to search in sString

Example

dcltrans
  transaction TStrstr
  var
    sString, sSubString, sResult: string;
  begin
    sString    := "Hope the weather will be fine tomorrow!";
    sSubString := "the";
    write("string    = "); write(sString); writeln;
    write("substring = "); write(sSubString); writeln;

    sResult := Strstr(sString, sSubString);
    write("result    = "); write(sResult); writeln;
  end TStrstr;

Output

string    = Hope the weather will be fine tomorrow!
substring = the
result    = the weather will be fine tomorrow!