TStringHelper.IndexOfAny
Find the position (index) of any string or character in a list.
Declaration
Source position: syshelph.inc line 118
public
function IndexOfAny(const AnyOf: Array of Char) : SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of Char; StartIndex: SizeInt)
: SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of Char; StartIndex: SizeInt;
ACount: SizeInt) : SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of string) : SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of string; StartIndex: SizeInt)
: SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of string; StartIndex: SizeInt;
ACount: SizeInt) : SizeInt; Overload;
function IndexOfAny(const AnyOf: Array of string; StartIndex: SizeInt;
ACount: SizeInt; out AMatch: SizeInt) : SizeInt
; Overload;
Description
IndexOfAny returns the zero-based index of the first matching element in an array of characters or strings (AnyOf).
if no match is found, -1 is returned.
The search can be refined by specifying a (zero-based) index StartIndex. When specified, the search will start at the given character. Not specifying this option is equivalent to specifying zero.
If ACount is given, at most ACount characters in the source string will be considered for the search. This count includes the starting character. Not specifying this argument is equivalent to specifying the amount of remaining characters.
If AMatch is specified, on successful return it will contain the index of the element in the array that contains the found match.
See also
Name | Description |
---|---|
Pos | Search for substring in a string. |
TStringHelper.IndexOf | Find the position (index) of a string or character |
TStringHelper.IndexOfAnyUnquoted | Find the position (index) of any string or character in a list. |
TStringHelper.IndexOfUnquoted | Index of string, skipping quoted parts. |
TStringHelper.LastIndexOf | Find the last position (index) of a string or character |
TStringHelper.LastIndexOfAny | Find the last position (index) of any string or character in a list. |