API:Data.DBXPlatform.TDBXStringList.IndexOf

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

Properties

Type Visibility Source Unit Parent
function public System.Classes.pas Data.DBXPlatform TDBXStringList

Description

Returns the position of a string in the list.

Data.DBXPlatform.TDBXStringList.IndexOf inherits from System.Classes.TStrings.IndexOf. All content below this line refers to System.Classes.TStrings.IndexOf.

Returns the position of a string in the list.

Call IndexOf to obtain the position of the first occurrence of the S string. IndexOf is not case-sensitive; this means that the given string may differ in case from the string in the list. For example:

String1 := MyStrings.Items.IndexOf('My First String');

is equivalent to

String1 := MyStrings.Items.IndexOf('My FIRST String');

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 is not in the string list, IndexOf returns -1.

Note: If the string appears in the list more than once, IndexOf returns the position of the first occurrence.

See Also

Code Examples