System.StrUtils.PosEx

提供: RAD Studio API Documentation
移動先: 案内検索

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 */;

プロパティ

種類 可視性 ソース ユニット
function public
System.StrUtils.pas
System.StrUtils.hpp
System.StrUtils System.StrUtils


説明

文字列内で最初に出現する部分文字列のインデックスを返します。

PosEx は、Offset の位置から検索を開始して、S 内で見つかった SubStr のインデックスを返します。

Offset が 1(デフォルト)の場合、PosEx は Pos と同じ動作をします。

SubStr が見つからないか Offset が無効である(S の長さより大きいまたは 1 より小さい)場合、結果は 0 になります。

例(Delphi):

Writeln(IntToStr(PosEx('cd', 'abcdef', 2))); // displays 3
メモ: PosExSystem.Pos と同等です。

関連項目