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



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'System' (#rtl)

Pos

Search for substring in a string.

Declaration

Source position: line 0

function Pos(

  const substr: shortstring;

  const s: shortstring

):SizeInt;

function Pos(

  C: Char;

  const s: shortstring

):SizeInt;

function Pos(

  const Substr: ShortString;

  const Source: AnsiString

):SizeInt;

function pos(

  const substr: shortstring;

  c: Char

):SizeInt;

function Pos(

  const Substr: AnsiString;

  const Source: AnsiString

):SizeInt;

function Pos(

  c: Char;

  const s: AnsiString

):SizeInt;

function Pos(

  const Substr: WideString;

  const Source: WideString

):SizeInt;

function Pos(

  c: Char;

  const s: WideString

):SizeInt;

function Pos(

  c: WideChar;

  const s: WideString

):SizeInt;

function Pos(

  c: WideChar;

  const s: AnsiString

):SizeInt;

function Pos(

  c: AnsiString;

  const s: WideString

):SizeInt;

function Pos(

  c: WideString;

  const s: AnsiString

):SizeInt;

function Pos(

  c: ShortString;

  const s: WideString

):SizeInt;

function Pos(

  c: Char;

  const v: Variant

):SizeInt;

function Pos(

  s: ShortString;

  const v: Variant

):SizeInt;

function Pos(

  a: AnsiString;

  const v: Variant

):SizeInt;

function Pos(

  w: WideString;

  const v: Variant

):SizeInt;

function Pos(

  v: Variant;

  const c: Char

):SizeInt;

function Pos(

  v: Variant;

  const s: ShortString

):SizeInt;

function Pos(

  v: Variant;

  const a: AnsiString

):SizeInt;

function Pos(

  v: Variant;

  const w: WideString

):SizeInt;

function Pos(

  v1: Variant;

  const v2: Variant

):SizeInt;

Description

Pos returns the index of Substr in S, if S contains Substr. In case Substr isn't found, 0 is returned. The search is case-sensitive.

Errors

None

See also

Length

  

Calculate length of a string.

Copy

  

Copy part of a string.

Delete

  

Delete part of a string.

Insert

  

Insert one string in another.

Example

Program Example48;

{ Program to demonstrate the Pos function. }

Var
  S : String;

begin
  S:='The first space in this sentence is at position : ';
  Writeln (S,pos(' ',S));
  S:='The last letter of the alphabet doesn''t appear in this sentence ';
  If (Pos ('Z',S)=0) and (Pos('z',S)=0) then
    Writeln (S);
end.

Notes

 No notes exist for this page yet. 





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