HtmlDecode
string-functions HtmlDecode
The HtmlDecode function decodes HTML-encoded strings back to their original form.
syntax
HtmlDecode(strings: E->String) -> E->String
definition
Converts HTML-encoded strings back to their original format by replacing HTML entity references with the corresponding characters:
| Entity | Character |
|---|---|
< | < |
> | > |
& | & |
" | " |
' | ' |
| (space) |
Also decodes numeric character references like < and <.
arguments
| argument | description | type |
|---|---|---|
| strings | HTML-encoded strings to decode | E->String |
performance
Time complexity: O(n × L) where n is the number of strings and L is the average string length.
Decoded strings are typically slightly shorter than input strings.
example
unit<uint32> HtmlContent: nrofrows = 3;
attribute<String> encoded (HtmlContent) := union_data(HtmlContent,
'Hello <world>',
'A & B',
'Quote: "test"'
);
attribute<String> decoded (HtmlContent) := HtmlDecode(encoded);
// decoded = {'Hello <world>', 'A & B', 'Quote: "test"'}
use cases
- Processing data extracted from HTML sources
- Converting HTML content to plain text
- Cleaning up HTML entity artifacts in imported data
see also
- htmlencode - reverse operation
- urldecode - for URL parameters
- string-functions
since version
7.0