Field-Map Scripting

4.5.1.13 Exchange

Exchange procedure


Prototype:

procedure Exchange(Index1, Index2 :integer);

Description:

Exchange procedure swaps two strings in the StringList by their indexes. At the Index1 will be placed string at the Index2 (and vice versa). Indexes are counted from 0.

Syntax:

StringList.Exchange(Index1, Index2);


Part

Description


StringList

A reference to an instance of a TStringListWrapper


Index1

An integer parameter represents index of string in the StringList


Index2

An integer parameter represents index of string in the StringList

Return value:

none



Example:


var

 strList1 : TStringListWrapper;

 t : string;


begin

 strList1 := CreateStringList;


 strList1.BeginUpdate;

 strList1.Add('Picea');

 strList1.Add('Fagus');  // this one will be it swapped

 strList1.Add('Pinus');  // this one will be it swapped

 strList1.EndUpdate;


 strList1.Exchange(1,2);


 t:= strList1.Text;


 ShowMsg(t);


 strList1.Free;

end.



Output in Field-Map Data Collector:



See also:

Free; Duplicates; Sorted; CaseSensitive; BeginUpdate; EndUpdate; Add; AddStrings; Assign; Clear; Delete; Count; Exchange; Move; Find; IndexOf; Insert; Sort; LoadFromFile; SaveToFile; Strings; Text; Delimiter; DelimitedText; NameValueSeparator; IndexOfName; Name; Value; AsVarArray