Skip to content

Flow documentation · legacy product

Pos ​

Declaration ​

function Pos( const Pattern, S : string) : integer

Example ​

pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := Pos('-',’ab-cde-fgh'); //returns 3
Value := Pos('00', '12-1234-0012345-00'); // returns 9
Value := Pos('xx', 'abcdef'); // returns 0
Value := Pos('x', ''); // returns 0
Value := Pos('', 'xxx'); // returns 0
Value := Pos('a', 'AAA'); // returns 0
end;

Description ​

Returns the position of the first occurrence of Pattern in string S. The first position in S is 1. Pattern can have any number of characters.

If Pattern is not found then Pos returns 0. If Pattern or S is an empty string (i.e. length is zero) then Pos returns 0. If Pattern is longer than S then Pos returns 0.

Pos is case-sensitive (i.e. the characters are matched exactly).