Indy 9
PosInStrArray
Unit: IdGlobal
Searches an array of strings for an occurrence of the search string.
function PosInStrArray(const SearchStr: string; Contents: array of string; const CaseSensitive: Boolean = True): Integer;
Unit
IdGlobal
Parameters
const SearchStr: string
The value to find in the array of strings.
Contents: array of string
- The array of strings to be searched.
const CaseSensitive: Boolean = True
Use case sensitivity, Default value is True.
Return Value
Integer - Position of the search string in the array, or -1 when not found.
Description
PosInStrArray is an Integer function used find the first occurrence of the search string specified in SearchStr in the array Contents.

The lower and upper limits of the array Contents is determined using the Low and High functions.

When CaseSensitive is True, the values in SearchStr and the current array element must be an exact match. When CaseSensitive is False, the function AnsiSameText is used to compare SearchStr to the string in the current array position.

The return value for the PosInStrArray function will be -1 if the search string does not exist in Contents.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.