mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 09:09:30 +02:00
* AlwaysQuote added (bug ID 31126)
git-svn-id: trunk@35333 -
This commit is contained in:
parent
0013769c4b
commit
f0a8355b84
@ -603,6 +603,7 @@ type
|
||||
FDefaultEncoding: TEncoding;
|
||||
FEncoding: TEncoding;
|
||||
FSpecialCharsInited : boolean;
|
||||
FAlwaysQuote: Boolean;
|
||||
FQuoteChar : Char;
|
||||
FDelimiter : Char;
|
||||
FNameValueSeparator : Char;
|
||||
@ -707,6 +708,7 @@ type
|
||||
property Encoding: TEncoding read FEncoding;
|
||||
property LineBreak : string Read GetLineBreak write SetLineBreak;
|
||||
Property StrictDelimiter : Boolean Read FStrictDelimiter Write FStrictDelimiter;
|
||||
property AlwaysQuote: Boolean read FAlwaysQuote write FAlwaysQuote;
|
||||
property QuoteChar: Char read GetQuoteChar write SetQuoteChar;
|
||||
Property NameValueSeparator : Char Read GetNameValueSeparator Write SetNameValueSeparator;
|
||||
property ValueFromIndex[Index: Integer]: string read GetValueFromIndex write SetValueFromIndex;
|
||||
|
@ -200,7 +200,8 @@ Var
|
||||
p : pchar;
|
||||
BreakChars : set of char;
|
||||
S : String;
|
||||
|
||||
doQuote : Boolean;
|
||||
|
||||
begin
|
||||
CheckSpecialChars;
|
||||
result:='';
|
||||
@ -213,11 +214,16 @@ begin
|
||||
For i:=0 to count-1 do
|
||||
begin
|
||||
S:=Strings[i];
|
||||
p:=pchar(S);
|
||||
//Quote strings that include BreakChars:
|
||||
while not(p^ in BreakChars) do
|
||||
inc(p);
|
||||
if (p<>pchar(S)+length(S)) then
|
||||
doQuote:=FAlwaysQuote;
|
||||
If not DoQuote then
|
||||
begin
|
||||
p:=pchar(S);
|
||||
//Quote strings that include BreakChars:
|
||||
while not(p^ in BreakChars) do
|
||||
inc(p);
|
||||
DoQuote:=(p<>pchar(S)+length(S));
|
||||
end;
|
||||
if DoQuote then
|
||||
Result:=Result+QuoteString(S,QuoteChar)
|
||||
else
|
||||
Result:=Result+S;
|
||||
@ -722,6 +728,7 @@ begin
|
||||
FDefaultEncoding:=TEncoding.Default;
|
||||
FEncoding:=nil;
|
||||
FWriteBOM:=True;
|
||||
FAlwaysQuote:=False;
|
||||
end;
|
||||
|
||||
Function TStrings.Add(const S: string): Integer;
|
||||
|
Loading…
Reference in New Issue
Block a user