System.WideStrings.TWideStringList.IndexOf

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function IndexOf(const S: WideString): Integer; override;

C++

virtual int __fastcall IndexOf(const System::WideString S);

Properties

Type Visibility Source Unit Parent
function public
System.WideStrings.pas
System.WideStrings.hpp
System.WideStrings TWideStringList

Description

Returns the position of a string in the list.

Call IndexOf to obtain the position of the first occurrence of a string that matches S. A string matches S if it is identical to S or, if CaseSensitive is False, if they differ only in case.

IndexOf will work in this way on the condition that Sorted is set to False and Duplicates is set to dupIgnore or dupError. This reflects the internal definition of IndexOf, which calls Find if Sorted is set to True and will locate any string in the list that matches the parameter S. Consequently, if Duplicates is set to dupAccept, the result will not always be the first string matching the parameter S.

IndexOf returns the 0-based index of the string. Thus, if S matches the first string in the list, IndexOf returns 0, if S is the second string, IndexOf returns 1, and so on. If the string does not have a match in the string list, IndexOf returns -1.

See Also