TSubstringListInvariant.Add Method

Overload List

#SignatureDescription
1function Add(const S: string): Integer; overload;Adds S: at the end, or, in a sorted list, at its place.
2function Add(const Src: string; const SrcIdx, SrcLen: Integer): Integer; overload;Adds SrcLen characters of Src from SrcIdx (1-based) as an item.

Overload 1: function Add(const S: string): Integer; overload;

Adds S: at the end, or, in a sorted list, at its place.

#NameDescription
1S

The text, every text kind; it may be an item of this list.

Returns: Integer - The new item's index; in a sorted list under dupIgnore, the index of the equal item already there.

Remarks:

A Substring is stored as an assignment stores it: a view stays a view of the same characters (List[i] of another item included, which dangles once that item is written or deleted); a list's long item, or a Substring taken from one, is shared; any other text is copied.

Overload 2: function Add(const Src: string; const SrcIdx, SrcLen: Integer): Integer; overload;

Adds SrcLen characters of Src from SrcIdx (1-based) as an item.

#NameDescription
1Src

The text, every text kind but Char.

2SrcIdx

The part's first character, from 1.

3SrcLen

The part's length.

Returns: Integer - The new item's index.

Remarks:

The range must lie inside Src, else ESubstringRangeError is raised.