mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 21:46:00 +02:00
* updated ansiexctractquotedstring (more delphi compat, both interface and code)
This commit is contained in:
parent
f7b8c5bebb
commit
d7cc714078
@ -476,25 +476,40 @@ end ;
|
|||||||
deleted to the left and right and double occurances
|
deleted to the left and right and double occurances
|
||||||
of Quote replaced by a single Quote }
|
of Quote replaced by a single Quote }
|
||||||
|
|
||||||
function AnsiExtractQuotedStr(Const Src: PChar; Quote: Char): string;
|
|
||||||
var i: integer; P, Q: PChar;
|
function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
|
||||||
|
var i: integer; P, Q,R: PChar;
|
||||||
begin
|
begin
|
||||||
P := Src;
|
P := Src;
|
||||||
if Src^ = Quote then P := P + 1;
|
Q := StrEnd(P);
|
||||||
Q := StrEnd(P);
|
result:='';
|
||||||
if PChar(Q - 1)^ = Quote then Q := Q - 1;
|
if P=Q then exit;
|
||||||
SetLength(result, Q - P);
|
if P^<>quote then exit;
|
||||||
i := 0;
|
inc(p);
|
||||||
while P <> Q do begin
|
|
||||||
i := i + 1;
|
setlength(result,(Q-P)+1);
|
||||||
result[i] := P^;
|
R:=@Result[1];
|
||||||
if (P^ = Quote) and (PChar(P + 1)^ = Quote) then
|
i := 0;
|
||||||
P := P + 1;
|
while P <> Q do
|
||||||
P := P + 1;
|
begin
|
||||||
|
R^:=P^;
|
||||||
|
inc(R);
|
||||||
|
if (P^ = Quote) then
|
||||||
|
begin
|
||||||
|
P := P + 1;
|
||||||
|
if (p^ <> Quote) then
|
||||||
|
begin
|
||||||
|
dec(R);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
P := P + 1;
|
||||||
end ;
|
end ;
|
||||||
SetLength(result, i);
|
src:=p;
|
||||||
|
SetLength(result, (R-pchar(@Result[1])));
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
|
|
||||||
{ AdjustLineBreaks returns S with all CR characters not followed by LF
|
{ AdjustLineBreaks returns S with all CR characters not followed by LF
|
||||||
replaced with CR/LF }
|
replaced with CR/LF }
|
||||||
// under Linux all CR characters or CR/LF combinations should be replaced with LF
|
// under Linux all CR characters or CR/LF combinations should be replaced with LF
|
||||||
@ -2187,7 +2202,10 @@ const
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 2004-08-30 18:00:12 michael
|
Revision 1.17 2004-11-16 18:30:35 marco
|
||||||
|
* updated ansiexctractquotedstring (more delphi compat, both interface and code)
|
||||||
|
|
||||||
|
Revision 1.16 2004/08/30 18:00:12 michael
|
||||||
+ Extra index check in IsDelimiter
|
+ Extra index check in IsDelimiter
|
||||||
|
|
||||||
Revision 1.15 2004/08/07 19:32:35 florian
|
Revision 1.15 2004/08/07 19:32:35 florian
|
||||||
|
@ -107,7 +107,7 @@ function TrimLeft(const S: string): string;
|
|||||||
function TrimRight(const S: string): string;
|
function TrimRight(const S: string): string;
|
||||||
function QuotedStr(const S: string): string;
|
function QuotedStr(const S: string): string;
|
||||||
function AnsiQuotedStr(const S: string; Quote: char): string;
|
function AnsiQuotedStr(const S: string; Quote: char): string;
|
||||||
function AnsiExtractQuotedStr(Const Src: PChar; Quote: Char): string;
|
function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
|
||||||
function AdjustLineBreaks(const S: string): string;
|
function AdjustLineBreaks(const S: string): string;
|
||||||
function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
|
function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
|
||||||
function IsValidIdent(const Ident: string): boolean;
|
function IsValidIdent(const Ident: string): boolean;
|
||||||
@ -193,7 +193,10 @@ function BCDToInt(Value: integer): integer;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2004-08-30 13:07:03 michael
|
Revision 1.10 2004-11-16 18:30:36 marco
|
||||||
|
* updated ansiexctractquotedstring (more delphi compat, both interface and code)
|
||||||
|
|
||||||
|
Revision 1.9 2004/08/30 13:07:03 michael
|
||||||
+ Added MACOS linebreakstyle (tlbsCR)
|
+ Added MACOS linebreakstyle (tlbsCR)
|
||||||
|
|
||||||
Revision 1.8 2004/08/07 16:56:28 florian
|
Revision 1.8 2004/08/07 16:56:28 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user