TStrings.CommaText

Applies to TestComplete 14.93, last modified on October 12, 2021

Obtains or sets all strings as a single line of comma-separated text.

Declaration

TStringsObj.CommaText
Read-Write Property String
TStringsObj     A TStrings object  

Description

The CommaText property lets you obtain or set all strings in the given TStrings object as a single line of comma-separated text.

Property Value

A string holding the comma-separated list of the TStrings object’s lines. The format of the resulting string is described in the Remarks section.

Remarks

CommaText is the same as the DelimitedText property with Delimiter set to comma character (“,”) and QuoteChar set to double quote character (“"”).

When you retrieve the CommaText property's value, all strings containing spaces, commas or quotes will be enclosed in double quotes and double quote characters that are part of strings will be duplicated. For example, if the TStrings object contains the following strings:

String1
String 2
String,3
String"4

its CommaText property will return the following string:

String1,"String 2","String,3","String""4"

When you set the list of strings via the CommaText property, you should separate single strings by spaces or commas and optionally enclose each string in double quotes. If a string contains spaces or commas it must be enclosed in double quotes, otherwise spaces and commas will be treated as separators. To specify a double quote character within the string, you must duplicate it. To specify an empty string, place two commas next to each other. To specify an empty string at the end of the list, place the trailing comma. For example, if you set the following string to the CommaText property:

String1, "String 2", , String 3 "String, 4" "String""5,

the TStrings object will contain the following strings:

String1
String 2
[Empty string]
String
3
String, 4
String"5
[Empty string]

See Also

TStrings.DelimitedText
TStrings.Delimiter
TStrings.QuoteChar
TStrings.Text

Highlight search results