help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Procedures and functions] Reference for unit 'strings' (#rtl)

strpos

Search for a null-terminated substring in a null-terminated string

Declaration

Source position: strings.pp line 80

function strpos(

  str1: pchar;

  str2: pchar

):pchar;

Description

Returns a pointer to the first occurrence of S2 in S1. If S2 does not occur in S1, returns Nil.

Errors

None.

See also

StrScan

  

Find first occurrence of a character in a null-terminated string.

StrRScan

  

Find last occurrence of a character in a null-terminated string.

Example

Program Example15;

Uses strings;

{ Program to demonstrate the StrPos function. }

Const P : PChar = 'This is a PChar string.';
      S : Pchar = 'is';
begin
  Writeln ('Position of ''is'' in P : ',longint(StrPos(P,S))-Longint(P));
end.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505