Show: Delphi C++
Display Preferences

System.StrUtils.PosEx

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function PosEx(const SubStr, S: string; Offset: Integer): Integer;

C++

extern DELPHI_PACKAGE int __fastcall PosEx(const System::UnicodeString SubStr, const System::UnicodeString S, int Offset = 0x1)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.StrUtils.pas
System.StrUtils.hpp
System.StrUtils System.StrUtils

Description

Returns the index of the first occurrence of a substring within a string.

PosEx returns the index of SubStr in S, beginning the search at Offset.

If Offset is 1 (default), PosEx is equivalent to Pos.

If SubStr is not found or Offset is invalid (greater than the length of S or less than 1), then the result is 0.

Example (Delphi):

Writeln(IntToStr(PosEx('cd', 'abcdef', 2))); // displays 3
Note: PosEx is equivalent to System.Pos.

See Also

Personal tools
In Other Languages
Previous Versions
Assistance