Skip to content

PosEx

Search for the occurrence of a character in a string, starting at a certain position.

Declaration

Source position: strutils.pp line 134

function PosEx(const SubStr: Ansistring; const S: Ansistring; 
              Offset: SizeInt) : SizeInt;
function PosEx(const SubStr: Ansistring; const S: Ansistring) : SizeInt;
function PosEx(c: AnsiChar; const S: AnsiString; Offset: SizeInt)
               : SizeInt;
function PosEx(const SubStr: UnicodeString; const S: UnicodeString; 
              Offset: SizeInt) : SizeInt;
function PosEx(c: WideChar; const S: UnicodeString; Offset: SizeInt)
               : SizeInt;
function PosEx(const SubStr: UnicodeString; const S: UnicodeString)
               : SizeInt;

Description

PosEx returns the position of the first occurrence of the character C or the substring SubStr in the string S, starting the search at position Offset (default 1). If C or SubStr does not occur in S after the given Offset, zero is returned. The position Offset is also searched.

Errors

None.

See also

Name Description
NPos Returns the position of the N-th occurrence of a substring in a string.
AnsiContainsText Check whether a string contains a certain substring, ignoring case.
AnsiContainsStr Checks whether a string contains a given substring.