Sign in Join
FPDoc Onlineexperiment

TStrings.IndexOf function

Member of TStringspublicIn unit Classes

Find a string in the list and return its position.

Declaration

pascal
function IndexOf(const S: string): Integer; virtual
function IndexOf(const S: string; aStart: Integer): Integer; virtual

Description

IndexOf searches the list for S starting from index aStart. The start position aStart is 0 if not specified. If it is negative, it is considered an offset from Count. The search is case-insensitive or case sensitive depending on the value of the CaseSensitive . If a matching entry is found, its position is returned. if no matching string is found, -1 is returned.

  1. Only the first occurrence of the string is returned.
  2. The returned position is zero-based, i.e. 0 indicates the first string in the list.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.