UnicodeString TStrings::GetDelimitedText() const { UnicodeString Result; intptr_t Count = GetCount(); if ((Count == 1) && GetString(0).IsEmpty()) { Result = GetQuoteChar() + GetQuoteChar(); } else { for (intptr_t I = 0; I < GetCount(); I++) { UnicodeString line = GetString(I); Result += GetQuoteChar() + line + GetQuoteChar() + GetDelimiter(); } if (Result.Length() > 0) Result.SetLength(Result.Length() - 1); } return Result; }
UnicodeString TStrings::GetCommaText() const { wchar_t LOldDelimiter = GetDelimiter(); wchar_t LOldQuoteChar = GetQuoteChar(); FDelimiter = L','; FQuoteChar = L'"'; UnicodeString Result; SCOPE_EXIT { FDelimiter = LOldDelimiter; FQuoteChar = LOldQuoteChar; }; Result = GetDelimitedText(); return Result; }
UnicodeString TStrings::GetCommaText() const { wchar_t LOldDelimiter = GetDelimiter(); wchar_t LOldQuoteChar = GetQuoteChar(); FDelimiter = L','; FQuoteChar = L'"'; UnicodeString Result; auto cleanup = finally([&]() { FDelimiter = LOldDelimiter; FQuoteChar = LOldQuoteChar; }); { Result = GetDelimitedText(); } return Result; }
const char* OUTPUTFORMATTER::GetQuoteChar( const char* wrapee ) { return GetQuoteChar( wrapee, quoteChar ); }