System.Classes.TStrings.CommaText

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

property CommaText: string read GetCommaText write SetCommaText;

C++

__property System::UnicodeString CommaText = {read=GetCommaText, write=SetCommaText};

プロパティ

種類 可視性 ソース ユニット
property public
System.Classes.pas
System.Classes.hpp
System.Classes TStrings

説明

システムデータ形式(SDF)でリストされている TStrings オブジェクト内の文字列リストです。

CommaText プロパティは TStrings オブジェクト内のすべての文字列を単一のカンマ区切り文字列として取得および設定できます。

CommaText を取得するときに文字列リストの文字列にスペース,カンマ,または引用符がある場合には,文字列は二重引用符で囲まれ,二重引用符がある場合には二重引用符が連続して付けられます。たとえば,文字列リストに次の文字列があるとします。

Stri,ng 1 Stri"ng 2 String 3 String4

CommaText は次を返します。

"Stri,ng 1","Stri""ng 2","String 3",String4

CommaText を割り当てる場合,値は SDF 書式付きテキストとして解析されます。SDF 形式の場合,文字列はスペースまたはカンマで区切られ,任意で二重引用符で囲まれます。文字列に二重引用符がある場合,元の文字列と文字列を囲む引用符を区別するために続けて引用符を付けます。二重引用符で囲まれていないスペースおよびカンマは区切り文字です。2 つ並んだカンマは空の文字列を意味しますが,区切り文字の前後にあるスペースは無視されます。たとえば,CommaText を次のように設定するとします。

"Stri,ng 1", "Stri""ng 2" , String 3,String4

リストには次の文字列が含まれます。

Stri,ng 1 Stri"ng 2 String 3 String4

メモ:  CommaText プロパティは,区切り文字が ',',引用符が "DelimitedText プロパティと同じです。

元の文字列の末尾にカンマを入れると,文字列リストに空白の項目が取り込まれます。たとえば,CommaText を次のように設定すると,

"String1, String 2, String 3,"

文字列リストには以下の項目が入ります。

String1 String2 String3 <Blank>

関連項目