Accessing TStrings based properties

   

 

You will note that some Action properties are of type TStrings. TStrings is a standard Delphi type that we have exposed to the scripting engine. It is basically a string collection. Below are the properties of TStrings that you will find useful:

 

  procedure Clear;

  function Add(const S: string): Integer;

  procedure Delete(Index: Integer);

  procedure Insert(Index: Integer; const S: string);

  function IndexOf(const S: string): Integer;

  property Strings[Index: Integer]: string; //index is zero based

  property Count: Integer;

  property Text: string; //returns the entries in the collection, each entry on a new line

  property Names[Index: Integer]: string;  // used to access the name of a string which is of the format <name>=<value>

  property Values[Index: String]: string;  // used to access the value of a string which is of the format <name>=<value>

  property ValueFromIndex[Index: Integer] : string; // used to access the value of a string which is of the format <name>=<value>

 

Example:

The following code reduces each item in a List Iterator's list of items down to its leftmost three characters:

 

TStringsExample