System.Classes.TStrings.CommaText
Delphi
property CommaText: string read GetCommaText write SetCommaText;
C++
__property System::UnicodeString CommaText = {read=GetCommaText, write=SetCommaText};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | System.Classes.pas System.Classes.hpp |
System.Classes | TStrings |
Description
Lists the strings in the TStrings object in a single comma-delimited string.
Use CommaText to get or set all the strings in the TStrings object in a single comma-delimited string. 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:
Stri,ng1 Stri"ng2 String 3 String4
CommaText will return:
"Stri,ng1","Stri""ng2","String 3",String4
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. Spaces and commas that are not contained within double quote marks are delimiters. Two commas next to each other will indicate an empty string, but spaces that appear next to another delimiter are ignored. For example, suppose CommaText is set to:
"Stri,ng 1","Stri""ng 2",String 3,String4
The list will then contain:
Stri,ng 1 Stri"ng 2 String 3 String4
Note: CommaText is the same as the DelimitedText property with a delimiter of ',' and a quote character of '"'.
Including a trailing comma in the source string causes a blank item to be included in the string list. For example, if CommaText is set to
"String1,String2,String3, "
the string list will contain
String1 String2 String3 <Blank>