TStrings class
Class to manage arrays or collections of strings.
Declaration
TStrings = class(TPersistent)Inheritance
- TStrings
- TPersistent
- TObject
Descends from it: TCustomMemoStrings TNBBasePages TStringGridStrings TStringList TTabControlStrings TUNBPages
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
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.
See also
Properties
UpdateCount | protected | |
AlwaysQuote | public | Always quote strings in DelimitedText. |
Capacity | public | Capacity of the list, i.e. number of strings that the list can currently hold before it tries to expand. |
CommaText | public | Contents of the list as a comma-separated string. |
Count | public | Number of strings in the list. |
DefaultEncoding | public | Default encoding of stringlist. |
DelimitedText | public | Get or set all strings in the list in a delimited form. |
Delimiter | public | Delimiter character used in DelimitedText. |
Encoding | public | Current encoding of stringlist. |
LineBreak | public | LineBreak character to use. |
MissingNameValueSeparatorAction | public | What to do if NameValueSeparator is missing in a string. |
Names | public | Name parts of the name-value pairs in the list. |
NameValueSeparator | public | Value of the character used to separate name,value pairs. |
Objects | public | Indexed access to the objects associated with the strings in the list. |
Options | public | A set of - various boolean properties. |
QuoteChar | public | Quote character used in DelimitedText. |
SkipLastLineBreak | public | Do not add a linebreak to the last item. |
TrailingLineBreak | public | Add a linebreak to the last item. |
StrictDelimiter | public | Should only the delimiter character be considered a delimiter. |
Strings | public | Indexed access to the strings in the list. |
StringsAdapter | public | Not implemented in Free Pascal. |
Text | public | Contents of the list as one big string. |
TextLineBreakStyle | public | Determines which line breaks to use in the Text property. |
UseLocale | public | Determines what methods are used in strings comparison. |
ValueFromIndex | public | Return the value part of a string based on it's index. |
Values | public | Value parts of the name-value pairs in the list. |
WriteBOM | public | Write BOM when writing stringlist to stream. |
Methods
CompareStrings | protected | |
DefineProperties | protected | Method to stream the contents of the string collection. |
Error | protected | Raises an exception. |
Get | protected | Abstract read handler for the property. |
GetCapacity | protected | Abstract Read handler for the property. |
GetCount | protected | Abstract read handler for the property. |
GetObject | protected | Abstract read handler for the property. |
GetTextStr | protected | Read handler for the property. |
Put | protected | Write handler for the property. |
PutObject | protected | Write handler for the property. |
SetCapacity | protected | Write handler for the property. |
SetTextStr | protected | Write handler for the property. |
SetUpdateState | protected | Sets the update state. |
DoCompareText | protected | |
GetDelimitedText | protected | |
SetDelimitedText | protected | |
GetValueFromIndex | protected | |
SetValueFromIndex | protected | |
CheckSpecialChars | protected | |
GetNextLine | protected | |
GetNextLinebreak | protected | |
Create | public | Initializ a new TStrings instance. |
Destroy | public | Frees all strings and objects, and removes the list from memory. |
ToObjectArray | public | Return the objects as an array of object. |
ToStringArray | public | Return the strings as an array of string. |
Add | public | Add a string to the list. |
AddObject | public | Add a string and associated object to the list. |
AddPair | public | Add a name-value pair. |
AddStrings | public | Add contents of another stringlist to this list. |
SetStrings | public | Replace the strings with the passed strings. |
AddText | public | Add text to the string list. |
AddCommaText | public | Adds a comma-separated list of strings. |
AddDelimitedtext | public | Adds a separator-delimited list of strings. |
Append | public | Add a string to the list. |
Assign | public | Assign the contents of another stringlist to this one. |
BeginUpdate | public | Mark the beginning of an update batch. |
Clear | public | Removes all strings and associated objects from the list. |
Delete | public | Delete a string from the list. |
EndUpdate | public | Mark the end of an update batch. |
Equals | public | Compares the contents of two stringlists. |
Exchange | public | Exchanges two strings in the list. |
ExtractName | public | Extract the name part of a string. |
Filter | public | Return a filtered list. |
Fill | public | Set a range of strings in the list to the specified value. |
ForEach | public | Call a callback for each string in the list. |
GetEnumerator | public | Create an IEnumerator instance. |
GetNameValue | public | Return both name and value of a name,value pair based on it's index. |
GetText | public | Returns the contents as a PChar. |
Contains | public | |
ContainsObject | public | |
IndexOf | public | Find a string in the list and return its position. |
ContainsName | public | |
IndexOfName | public | Finds the index of a name in the name-value pairs. |
IndexOfObject | public | Finds an object in the list and returns its index. |
Insert | public | Insert a string in the list. |
InsertObject | public | Insert a string and associated object in the list. |
LastIndexOf | public | Return the index of the last occurrence of a string. |
LoadFromFile | public | Load the contents of a file as a series of strings. |
LoadFromStream | public | Load the contents of a stream as a series of strings. |
Map | public | Call a map routine for each string in the list. |
Move | public | Move a string from one place in the list to another. |
Pop | public | Remove the last string of the list and return it. |
Reduce | public | Get a reduced value from the string list. |
Reverse | public | Reverse the order of the strings in the list. |
SaveToFile | public | Save the contents of the list to a file. |
SaveToStream | public | Save the contents of the string to a stream. |
Shift | public | Return and remove the first string in the list. |
Slice | public | Return a subrange of strings starting at a given index. |
SetText | public | Set the contents of the list from a PChar. |
Inherited
From TPersistent (6)
AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath GetOwner
From TObject (39)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
