[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Classes' (#rtl)

TStrings

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Class to manage arrays or collections of strings

Declaration

Source position: classesh.inc line 603

type TStrings = class(TPersistent) end;

public

  destructor Destroy; override;

  

Frees all strings and objects, and removes the list from memory.

  function Add();

  

Add a string to the list

  function AddObject();

  

Add a string and associated object to the list.

  procedure Append();

  

Add a string to the list.

  procedure AddStrings();

  

Add contents of another stringlist to this list.

  procedure AddText(); virtual;

  

Add text to the string list.

  procedure Assign(); override;

  

Assign the contents of another stringlist to this one.

  procedure BeginUpdate;

  

Mark the beginning of an update batch.

  procedure Clear; virtual; abstract;

  

Removes all strings and associated objects from the list.

  procedure Delete(); virtual; abstract;

  

Delete a string from the list.

  procedure EndUpdate;

  

Mark the end of an update batch.

  function Equals();

  

Compares the contents of two stringlists.

  procedure Exchange(); virtual;

  

Exchanges two strings in the list.

  function GetEnumerator;

  

Create an IEnumerator instance

  function GetText; virtual;

  

Returns the contents as a PChar

  function IndexOf(); virtual;

  

Find a string in the list and return its position.

  function IndexOfName(); virtual;

  

Finds the index of a name in the name-value pairs.

  function IndexOfObject(); virtual;

  

Finds an object in the list and returns its index.

  procedure Insert(); virtual; abstract;

  

Insert a string in the list.

  procedure InsertObject();

  

Insert a string and associated object in the list.

  procedure LoadFromFile(); virtual;

  

Load the contents of a file as a series of strings.

  procedure LoadFromStream(); virtual;

  

Load the contents of a stream as a series of strings.

  procedure Move(); virtual;

  

Move a string from one place in the list to another.

  procedure SaveToFile(); virtual;

  

Save the contents of the list to a file.

  procedure SaveToStream(); virtual;

  

Save the contents of the string to a stream.

  procedure SetText(); virtual;

  

Set the contents of the list from a PChar.

  procedure GetNameValue();

  

Return both name and value of a name,value pair based on it's index.

  function ExtractName();

  

Extract the name part of a string

  property TextLineBreakStyle: TTextLineBreakStyle; [rw]

  

Determines which line breaks to use in the Text property

  property Delimiter: Char; [rw]

  

Delimiter character used in DelimitedText.

  property DelimitedText: string; [rw]

  

Get or set all strings in the list in a delimited form.

  property LineBreak: string; [rw]

  property StrictDelimiter: Boolean; [rw]

  

Should only the delimiter character be considered a delimiter

  property QuoteChar: Char; [rw]

  

Quote character used in DelimitedText.

  property NameValueSeparator: Char; [rw]

  

Value of the character used to separate name,value pairs

  property ValueFromIndex: string; [rw]

  

Return the value part of a string based on it's index.

  property Capacity: Integer; [rw]

  

Capacity of the list, i.e. number of strings that the list can currently hold before it tries to expand.

  property CommaText: string; [rw]

  

Contents of the list as a comma-separated string.

  property Count: Integer; [r]

  

Number of strings in the list.

  property Names: string; [r]

  

Name parts of the name-value pairs in the list.

  property Objects: TObject; [rw]

  

Indexed access to the objects associated with the strings in the list.

  property Values: string; [rw]

  

Value parts of the name-value pairs in the list.

  property Strings: string; default; [rw]

  

Indexed access to the strings in the list.

  property Text: string; [rw]

  

Contents of the list as one big string.

  property StringsAdapter: IStringsAdapter; [rw]

  

Not implemented in Free Pascal.

Inheritance

TStrings

  

Class to manage arrays or collections of strings

|

TPersistent,IFPObserved

  

Base class for streaming system and persistent properties.

|

TObject

  

Base class of all classes.

Description

TStrings implements an abstract class to manage an array of strings. It introduces methods to set and retrieve strings in the array, searching for a particular string, concatenating the strings and so on. It also allows an arbitrary object to be associated with each string.

It also introduces methods to manage a series of name=value settings, as found in many configuration files.

An instance of TStrings is never created directly, instead a descendent class such as TStringList should be created. This is because TStrings is an abstract class which does not implement all methods; TStrings also doesn't store any strings, this is the functionality introduced in descendents such as TStringList.

TStrings implements the IFPObserved interface: when the stringlist is changed, a ooChanged notification is sent to all observers.

See also

TStringList

  

Standard implementation of the TStrings class.

IFPObserved

  

Interface implemented by an object that can be observed.


Documentation generated on: Nov 14 2015