RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TWideStrings.IndexOf Method

Returns the position of a string in the list.

Pascal
function IndexOf(const S: WideString): Integer;
C++
__fastcall int IndexOf(const BSTR S);

Call IndexOf to obtain the position of the first occurrence of the string 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 is not in the string list, IndexOf returns -1. 

IndexOf uses a case-sensitive search. To locate a string case-insensitively, use the IndexOfIgnoreCase method instead.

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

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!