[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Class to manage arrays or collections of strings.
Source position: classesh.inc line 903
type TStrings = class(TPersistent) |
||
public |
||
constructor Create; |
|
Initializ a new TStrings instance. |
destructor Destroy; override; |
|
Frees all strings and objects, and removes the list from memory. |
function ToObjectArray(); |
|
Return the objects as an array of object. |
function ToStringArray(); |
|
Return the strings as an array of string. |
function Add(); |
|
Add a string to the list. |
function AddObject(); |
|
Add a string and associated object to the list. |
function AddPair(); |
|
Add a name-value pair. |
procedure AddStrings(); |
|
Add contents of another stringlist to this list. |
procedure SetStrings(); |
|
Replace the strings with the passed strings. |
procedure AddText(); virtual; |
|
Add text to the string list. |
procedure AddCommaText(); |
|
Adds a comma-separated list of strings. |
procedure AddDelimitedText(); |
|
Adds a separator-delimited list of strings. |
procedure Append(); |
|
Add a string to the 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 ExtractName(); |
|
Extract the name part of a string. |
procedure Filter(); |
|
Return a filtered list. |
procedure Fill(); |
|
Set a range of strings in the list to the specified value. |
procedure ForEach(); |
|
Call a callback for each string in the list. |
function GetEnumerator; |
|
Create an IEnumerator instance. |
procedure GetNameValue(); |
|
Return both name and value of a name,value pair based on it's index. |
function GetText; virtual; |
|
Returns the contents as a PChar. |
function IndexOf(); |
|
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(); virtual; |
|
Insert a string and associated object in the list. |
function LastIndexOf(); |
|
Return the index of the last occurrence of a string. |
procedure LoadFromFile(); |
|
Load the contents of a file as a series of strings. |
procedure LoadFromStream(); |
|
Load the contents of a stream as a series of strings. |
procedure Map(); |
|
Call a map routine for each string in the list. |
procedure Move(); virtual; |
|
Move a string from one place in the list to another. |
function Pop; |
|
Remove the last string of the list and return it. |
function Reduce(); |
|
Get a reduced value from the string list. |
function Reverse(); |
|
Reverse the order of the strings in the list. |
procedure SaveToFile(); |
|
Save the contents of the list to a file. |
procedure SaveToStream(); |
|
Save the contents of the string to a stream. |
function Shift; |
|
Return and remove the first string in the list. |
procedure Slice(); |
|
Return a subrange of strings starting at a given index. |
procedure SetText(); virtual; |
|
Set the contents of the list from a PChar. |
property AlwaysQuote: Boolean; [rw] |
|
Always quote strings in DelimitedText. |
|
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. |
|
Number of strings in the list. |
|
property DefaultEncoding: TEncoding; [rw] |
|
Default encoding of stringlist. |
property DelimitedText: string; [rw] |
|
Get or set all strings in the list in a delimited form. |
|
Delimiter character used in DelimitedText. |
|
|
Current encoding of stringlist. |
|
property LineBreak: string; [rw] |
|
LineBreak character to use. |
property MissingNameValueSeparatorAction: TMissingNameValueSeparatorAction; [rw] |
|
What to do if NameValueSeparator is missing in a string. |
property Names []: string; [r] |
|
Name parts of the name-value pairs in the list. |
property NameValueSeparator: Char; [rw] |
|
Value of the character used to separate name,value pairs. |
|
Indexed access to the objects associated with the strings in the list. |
|
property Options: TStringsOptions; [rw] |
|
A set of TStringsOption - various boolean properties. |
|
Quote character used in DelimitedText. |
|
property SkipLastLineBreak: Boolean; [rw] |
|
Do not add a linebreak to the last item. |
property TrailingLineBreak: Boolean; [rw] |
|
Add a linebreak to the last item. |
property StrictDelimiter: Boolean; [rw] |
|
Should only the delimiter character be considered a delimiter. |
property Strings []: string; default; [rw] |
|
Indexed access to the strings in the list. |
property StringsAdapter: IStringsAdapter; [rw] |
|
Not implemented in Free Pascal. |
property Text: string; [rw] |
|
Contents of the list as one big string. |
property TextLineBreakStyle: TTextLineBreakStyle; [rw] |
|
Determines which line breaks to use in the Text property. |
property UseLocale: Boolean; [rw] |
|
Determines what methods are used in strings comparison. |
property ValueFromIndex []: string; [rw] |
|
Return the value part of a string based on it's index. |
property Values []: string; [rw] |
|
Value parts of the name-value pairs in the list. |
property WriteBOM: Boolean; [rw] |
|
Write BOM when writing stringlist to stream. |
end; |
|
Class to manage arrays or collections of strings. |
|
| | ||
|
Base class for streaming system and persistent properties. |
|
| | ||
|
Base class of all classes. |
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 descendant 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 descendants such as TStringList.
TStrings implements the IFPObserved interface: when the stringlist is changed, a ooChanged notification is sent to all observers.
|
Standard implementation of the TStrings class. |
|
|
Interface implemented by an object that can be observed. |