Code: Select all
function EscapeQuotes(const Value: string): string;
var
I: Integer;
PrevChar, PrevPrevChar: string;
begin
Result := '';
PrevChar := ' ';
PrevPrevChar := ' ';
for I := 1 to Length(Value) do
begin
Result := Result + Value[I];
if (Value[I] = '''') and ((PrevChar <> '\') or
(PrevChar = '\') or (PrevPrevChar = '\')) then
Result := Result + '''';
PrevPrevChar := PrevChar;
PrevChar := Value[I];
end;
end;
Code: Select all
if (Value[I] = '''') and ((PrevChar <> '\') or
((PrevChar = '\') and (PrevPrevChar = '\'))) then
Anybody have any ideas?
Regards,
Ben.