Class Solution
java.lang.Object
g1401_1500.s1410_html_entity_parser.Solution
1410 - HTML Entity Parser.<p>Medium</p>
<p><strong>HTML entity parser</strong> is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself.</p>
<p>The special characters and their entities for HTML are:</p>
<ul>
<li><strong>Quotation Mark:</strong> the entity is <code>"</code> and symbol character is <code>"</code>.</li>
<li><strong>Single Quote Mark:</strong> the entity is <code>'</code> and symbol character is <code>'</code>.</li>
<li><strong>Ampersand:</strong> the entity is <code>&</code> and symbol character is <code>&</code>.</li>
<li><strong>Greater Than Sign:</strong> the entity is <code>></code> and symbol character is <code>></code>.</li>
<li><strong>Less Than Sign:</strong> the entity is <code><</code> and symbol character is <code><</code>.</li>
<li><strong>Slash:</strong> the entity is <code>⁄</code> and symbol character is <code>/</code>.</li>
</ul>
<p>Given the input <code>text</code> string to the HTML parser, you have to implement the entity parser.</p>
<p>Return <em>the text after replacing the entities by the special characters</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> text = “& is an HTML entity but &ambassador; is not.”</p>
<p><strong>Output:</strong> “& is an HTML entity but &ambassador; is not.”</p>
<p><strong>Explanation:</strong> The parser will replace the & entity by &</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> text = “and I quote: "…"”</p>
<p><strong>Output:</strong> “and I quote: \”…\""</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= text.length <= 10<sup>5</sup></code></li>
<li>The string may contain any possible characters out of all the 256 ASCII characters.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
entityParser
-