Sign in Join
FPDoc Onlineexperiment

TStrings.CommaText property

Member of TStringspublicIn unit Classes

Contents of the list as a comma-separated string.

Declaration

pascal
property CommaText: string read GetCommaText write SetCommaText;

Description

CommaText represents the stringlist as a single string, consisting of a comma-separated concatenation of the strings in the list. If one of the strings contains spaces, comma's or quotes it will be enclosed by double quotes. Any double quotes in a string will be doubled. For instance the following strings:

Comma,string
Quote"string
Space string
NormalString

is converted to

"Comma,string","Quote""string","Space string",NormalString

Conversely, when setting the CommaText property, the text will be parsed according to the rules outlined above, and the strings will be set accordingly. Note that spaces will in this context be regarded as string separators, unless the string as a whole is contained in double quotes. If the StrictDelimiter property is false, then whitespace characters near delimiters will be ignored. The following string:

"Comma,string" , "Quote""string",Space string,, NormalString

Will be converted to

Comma,string
Quote"string
Space
string

NormalString

If the TStrings.StrictDelimiter property is true, then the result will be as follows (where spaces are replaced with _ for clarity):

Comma,string
_
_"Quote""string"
Space_string

_NormalString

The CommaText is a special case of the DelimitedText property where the quote character is always the double quote (QuoteChar is ignored), and the delimiter is always a comma.

Setting CommaText is equivalent to clearing the stringlist and calling AddCommaText.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.