mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 12:39:27 +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
|
||||
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
|
||||
P := Src;
|
||||
if Src^ = Quote then P := P + 1;
|
||||
Q := StrEnd(P);
|
||||
if PChar(Q - 1)^ = Quote then Q := Q - 1;
|
||||
SetLength(result, Q - P);
|
||||
i := 0;
|
||||
while P <> Q do begin
|
||||
i := i + 1;
|
||||
result[i] := P^;
|
||||
if (P^ = Quote) and (PChar(P + 1)^ = Quote) then
|
||||
P := P + 1;
|
||||
P := P + 1;
|
||||
P := Src;
|
||||
Q := StrEnd(P);
|
||||
result:='';
|
||||
if P=Q then exit;
|
||||
if P^<>quote then exit;
|
||||
inc(p);
|
||||
|
||||
setlength(result,(Q-P)+1);
|
||||
R:=@Result[1];
|
||||
i := 0;
|
||||
while P <> Q do
|
||||
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 ;
|
||||
SetLength(result, i);
|
||||
src:=p;
|
||||
SetLength(result, (R-pchar(@Result[1])));
|
||||
end ;
|
||||
|
||||
|
||||
{ AdjustLineBreaks returns S with all CR characters not followed by LF
|
||||
replaced with CR/LF }
|
||||
// under Linux all CR characters or CR/LF combinations should be replaced with LF
|
||||
@ -2187,7 +2202,10 @@ const
|
||||
|
||||
{
|
||||
$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
|
||||
|
||||
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 QuotedStr(const S: string): 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; Style: TTextLineBreakStyle): string;
|
||||
function IsValidIdent(const Ident: string): boolean;
|
||||
@ -193,7 +193,10 @@ function BCDToInt(Value: integer): integer;
|
||||
|
||||
{
|
||||
$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)
|
||||
|
||||
Revision 1.8 2004/08/07 16:56:28 florian
|
||||
|
Loading…
Reference in New Issue
Block a user