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:
Method Call | Example | Description |
---|---|---|
<br>procedure Clear;<br> |
<br>Action.ListOfItems.Clear;<br> |
Clears the TStrings object of all the strings it contains. |
<br>function Add(const text: string): Integer;<br> |
<br>var index = Action.ListOfItems.Add('Item 5');<br> |
Appends a string to the end of the list of string the TStrings object contains. The index of the newly added text is returned. |
<br>procedure Delete(index: Integer);<br> |
<br>Action.ListOfItems.Delete(5);<br> |
Deletes the string located at the passed in index. If the index does not exist and error is generated. |
<br>procedure Insert(index: Integer; const text: string);<br> |
<br>Action.ListOfItems.Insert(5, 'Item 5');<br> |
Inserts the passed in text at the passed in index. If the index is outside the bounds of the list which the TStrings object holds and error is generated. |
<br>function IndexOf(const text: string): Integer;<br> |
<br>Action.ListOfItems.IndexOf('Item 5');<br> |
Returns the index of the passed in string. If it doesn't exist in the list of string held by the TStrings object, -1 is returned. |
<br>property Strings[index: Integer]: string; <br> |
<br>var item5Text = Action.ListOfItems.Strings[5];<br> |
Returns the text held at the passed in index. The index is zero based. If the index does not exist in the current list of string help by the TStrings object an error is raised. |
<br>property Count: Integer;<br> |
<br>var count = Action.ListOfItems.Count;<br> |
Returns the number of string held by the TStrings object. |
<br>property Text: string; <br> |
<br>var list = Action.ListOfItems.Text;<br> |
Returns all the strings in the collection, each entry on a new line. |
<br>property Names[index: Integer]: string; <br> |
<br>var item5Name = Action.ListOfItems.Names[5];<br> |
Returns the name string held by the TStrings object at the passed in index. Strings can be stored in name=value pairs. This method allows access to the name part when this storage method is used. |
<br>property Values[name: String]: string; <br> |
<br>var item5Value = Action.ListOfItems.Values[item5Name];<br> |
Returns the value string held by the TStrings object for the passed in name. Strings can be stored in name=value pairs. This method allows access to the value part when this storage method is used. |
<br>property ValueFromIndex[index: Integer] : string;<br> |
<br>var item5Value = Action.ListOfItems.ValueFromIndex[5];<br> |
Returns the value string help by the TStrings object for the passed in index. Strings can be stored in name=value pairs. This method allows access to the value part when this storage method is used. |
The following code reduces each item in a List Iterator's list of items down to its leftmost three characters: