mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-09 20:17:51 +02:00
* Fix quotestring and add quotedstr
This commit is contained in:
parent
231bb41627
commit
5b3bc69a41
@ -210,6 +210,7 @@ Type
|
||||
|
||||
function StringReplace(aOriginal, aSearch, aReplace : string; Flags : TStringReplaceFlags) : String;
|
||||
function QuoteString(aOriginal : String; AQuote : Char) : String;
|
||||
function QuotedStr(const s: string; QuoteChar : Char = ''''): string;
|
||||
function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
|
||||
function AdjustLineBreaks(const S: string): string;
|
||||
function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
|
||||
@ -2072,12 +2073,14 @@ end;
|
||||
|
||||
Function QuoteString(aOriginal : String; AQuote : Char) : String;
|
||||
|
||||
Var
|
||||
REString : String;
|
||||
begin
|
||||
Result:=AQuote+StringReplace(aOriginal,aQuote,aQuote+aQuote,[rfReplaceAll])+AQuote;
|
||||
end;
|
||||
|
||||
function QuotedStr(const s: string; QuoteChar : Char = ''''): string;
|
||||
|
||||
begin
|
||||
REString:=TJSString(aQuote).replace(TJSRegexp.new(aOriginal,'g'),'\\$1');
|
||||
Result:=AQuote+TJSString(aOriginal).replace(TJSRegexp.new(REString,'g'),'$1\$1')+AQuote;
|
||||
Result:=QuoteString(S,QuoteChar);
|
||||
end;
|
||||
|
||||
function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
|
||||
@ -3834,6 +3837,7 @@ begin
|
||||
Result:='0'+Result;
|
||||
end;
|
||||
|
||||
|
||||
{ TFormatSettings }
|
||||
|
||||
function TFormatSettings.GetCurrencyDecimals: Byte;
|
||||
|
Loading…
Reference in New Issue
Block a user