From 092892ee82d8e24e181155a31d20fb192f00a14f Mon Sep 17 00:00:00 2001 From: joost Date: Tue, 14 Jun 2011 19:23:05 +0000 Subject: [PATCH] * Replaced 5 StringReplaces with one StringsReplace git-svn-id: trunk@17755 - --- packages/fcl-xml/src/htmlelements.pp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/packages/fcl-xml/src/htmlelements.pp b/packages/fcl-xml/src/htmlelements.pp index 5f0e5a25f3..06441fd246 100644 --- a/packages/fcl-xml/src/htmlelements.pp +++ b/packages/fcl-xml/src/htmlelements.pp @@ -18,7 +18,7 @@ unit htmlelements; interface uses - Classes, SysUtils, DOM, HtmlDefs; + Classes, SysUtils, DOM, HtmlDefs, strutils; type @@ -135,22 +135,14 @@ implementation function EscapeHTML ( const S : String ) : String; begin - Result := StringReplace(s, '&', '&', [rfReplaceAll]); - Result := StringReplace(Result, '<', '<', [rfReplaceAll]); - Result := StringReplace(Result, '>', '>', [rfReplaceAll]); - Result := StringReplace(Result, '"', '"', [rfReplaceAll]); - Result := StringReplace(Result, #39, ''', [rfReplaceAll]); // ' - ' does not work on ie :( + // ' does not work on all versions of ie, so do not use it. + Result := StringsReplace(s,['&','<','>','"',#39],['&','<','>','"','''],[rfReplaceAll]); end; function UnescapeHTML ( const S : String ) : String; begin - Result := StringReplace(s, '<', '<', [rfReplaceAll]); - Result := StringReplace(Result, '>', '>', [rfReplaceAll]); - Result := StringReplace(Result, '"', '"', [rfReplaceAll]); - Result := StringReplace(Result, ''', #39, [rfReplaceAll]); // ' - Result := StringReplace(Result, ''', #39, [rfReplaceAll]); // ' - Result := StringReplace(Result, '&', '&', [rfReplaceAll]); -end; + Result := StringsReplace(result,['&','<','>','"',''','''],['&','<','>','"',#39,#39],[rfReplaceAll]); +end; { THtmlCustomElement }