stringlistcontainer IndexOf method
Return to Introduction  Previous page  Next page
Applies to
acStringListContainer component.  

Declaration
function IndexOf(const S: String): Integer;  

Description
The IndexOf method returns the position of a string in the list.  
 
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.  
 
Note
iiwarning If the string appears in the list more than once, IndexOf returns the position of the first occurrence.  

See also
IndexOf, IndexOfName and IndexOfValue methods;  
Strings, Names, Values, MaxSize and Count properties.