IndexOfAny(Value: String; [StartIndex: Integer = 0;] [Count: Integer = -1]): Integer;
Value. The substring, which characters should be searched for in the string.
StartIndex. Index of the source string element, with which search should begin. By default, the search starts from the string beginning.
Count. The number of character places, within which the search is executed. By default, the search is executed within the entire string.
The IndexOfAny method returns the index of the first occurrence of any of substring characters passed in the Value parameter in the current string.
If none of the characters of the specified substring is found in the source string, the method returns -1. Characters are case-sensitive.
Sub UserProc;
Var
s: String;
Begin
s := "Text example";
Debug.WriteLine(s.IndexOfAny("ab"));
Debug.WriteLine(s.IndexOfAny("ae"));
Debug.WriteLine(s.IndexOfAny("ab", 3));
Debug.WriteLine(s.IndexOfAny("ae", 3, 3));
End Sub UserProc;
After executing the example the development environment console displays the following values:
-1
1
-1
5
See also: