RAD Studio VCL Reference
TStringList.IndexOf Method

Returns the position of a string in the list.

function IndexOf(const S: string): Integer; override;
virtual __fastcall int IndexOf(const AnsiString S);

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 it differs only in case.  

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. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!