[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 617

type TStrings = class(TPersistent)

protected

  procedure DefineProperties(); override;

  

Method to stream the contents of the string collection

  procedure Error();

  

Raises an EStringListError exception.

  function Get(); virtual; abstract;

  

Abstract read handler for the TStrings.Strings property.

  function GetCapacity; virtual;

  

Abstract Read handler for the TStrings.Capacity property.

  function GetCount; virtual; abstract;

  

Abstract read handler for the TStrings.Count property.

  function GetObject(); virtual;

  

Abstract read handler for the TStrings.Objects property.

  function GetTextStr; virtual;

  

Read handler for the TStrings.Text property.

  procedure Put(); virtual;

  

Write handler for the TStrings.Strings property.

  procedure PutObject(); virtual;

  

Write handler for the TStrings.Objects property.

  procedure SetCapacity(); virtual;

  

Write handler for the TStrings.Capacity property.

  procedure SetTextStr(); virtual;

  

Write handler for the TStrings.Text property.

  procedure SetUpdateState(); virtual;

  

Sets the update state.

  UpdateCount: Integer;

  function DoCompareText(); virtual;

  function GetDelimitedText;

  procedure SetDelimitedText();

  function GetValueFromIndex();

  procedure SetValueFromIndex();

  procedure CheckSpecialChars;

public

  destructor Destroy; override;

  

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

  function Add(); virtual;

  

Add a string to the list

  function AddObject(); virtual;

  

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 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

  TextLineBreakStyle: TTextLineBreakStyle;

  

Determines which line breaks to use in the Text property

  Delimiter: Char;

  

Delimiter character used in DelimitedText.

  DelimitedText: ;

  

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

  StrictDelimiter: Boolean;

  

Should only the delimiter character be considered a delimiter

  QuoteChar: Char;

  

Quote character used in DelimitedText.

  NameValueSeparator: Char;

  

Value of the character used to separate name,value pairs

  ValueFromIndex: ;

  

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

  Capacity: Integer;

  

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

  CommaText: ;

  

Contents of the list as a comma-separated string.

  Count: Integer;

  

Number of strings in the list.

  Names: ;

  

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

  Objects: TObject;

  

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

  Values: ;

  

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

  Strings: ;

  

Indexed access to the strings in the list.

  Text: ;

  

Contents of the list as one big string.

  StringsAdapter: IStringsAdapter;

  

Not implemented in Free Pascal.

end;

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.

See also

TStringList

  

Standard implementation of the TStrings class.

This page is hosted on Get Lazarus Code and Component Repository at SourceForge.net. Fast, secure and Free Open Source software downloads