What can TStringlist be used for in Delphi?

What can TStringlist be used for in Delphi?

TStringList is a utility class type. It is extremely useful for many kinds of list processing. Items in a string list may be inserted, moved and sorted. The list can be built string by string, or loaded from a comma separated big string, or even from a text file.

Which is the single comma delimited string format in commatext?

The single comma-delimited string format is also known as the system data format (SDF). When retrieving CommaText, any string in the list that include spaces, commas or double quotes will be contained in double quotes, and any double quotes in a string will be repeated. For example, if the list contains the following strings: CommaText will return:

When do you add a string to Delphi?

When true, Delphi treats strings as mixed case when perforing certain operations, such as Sort . You should of course set this property to the desired value before adding strings. When true all strings added will into a sorted sequence. When false, they are added at the end. See also the Sort method.

How are commatext strings separated in SDF format?

When assigning CommaText, the value is parsed as SDF formatted text. For SDF format, strings are separated by commas or spaces, and optionally enclosed in double quotes. Double quote marks that are part of the string are repeated to distinguish them from the quotes that surround the string.

Can a TStringlist be built from a string?

Items in a string list may be inserted, moved and sorted. The list can be built string by string, or loaded from a comma separated big string, or even from a text file. TStringList is derived from TStrings. Whilst you can use TStrings, it is not recommended since it is incomplete – some of the methods are abstract.

Can a delimiter be used as a reference in Delphi?

It also provides reference-counted interface. So this can be used even with older Delphi versions that have no SplitStrings and without careful and a bit tedious customizations of stock TStringList to only use specified delimiters. For example given text file of lines like Dog 5 4 7 one can parse them using:

How to enclose strings with embedded blanks in Delphi?

Strings containing embedded blanks must be enclosed in the QuoteChar (default is “). Used to enclose strings that have embedded blanks when using DelimitedText . Used to separate strings when using DelimitedText . Strings in a string list can be treated as name/value pairs, as in the second code example.