mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-16 23:09:22 +02:00
* Add EncodeHTMLEntities
This commit is contained in:
parent
7a882c55b8
commit
116614c42c
@ -626,6 +626,8 @@ function IsEqualGUID(const guid1, guid2: TGuid): Boolean;
|
||||
function GuidCase(const guid: TGuid; const List: array of TGuid): Integer;
|
||||
Function CreateGUID(out GUID : TGUID) : Integer;
|
||||
|
||||
Function EncodeHTMLEntities (S : String) : String;
|
||||
|
||||
implementation
|
||||
|
||||
procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
|
||||
@ -4427,5 +4429,17 @@ begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
Function EncodeHTMLEntities (S : String) : String;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
if S='' then exit;
|
||||
asm
|
||||
return S.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
|
||||
return '&#'+i.charCodeAt(0)+';';
|
||||
});
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user