next up previous contents index
Next: Power Up: Functions and Procedures Previous: Pi

Pos

   

Declaration:

Function Pos (Const Substr : String;Const S : String) : Byte;

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, Copy, Delete, Insert

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.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998