Takes a character and returns the escaped string for that character. For
example escapeChar(String.fromCharCode(15)) -> "\x0E".
@param {character} c The character to escape.
@return {string} An escaped string representing {@code c}.
Takes a string and returns the escaped string for that character.
@param {string} str The string to escape.
@return {string} An escaped string representing {@code str}.
Escapes double quote '"' and single quote ''' characters in addition to
'&', '<', and '>' so that a string can be included in an HTML tag attribute
value within double or single quotes.
Returns HTML-escaped text as a SafeHtml object, with newlines changed to
<br> and escaping whitespace to preserve spatial formatting. Character
entity #160 is used to make it safer for XML.
@param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If
the parameter is of type SafeHtml it is returned directly (no escaping
is done).
@return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml.
Truncates a string to a certain length and adds '...' if necessary. The
length also accounts for the ellipsis, so a maximum length of 10 and a string
'Hello World!' produces 'Hello W...'.
@param {string} str The string to truncate.
@param {number} chars Max number of characters.
@return {string} The truncated {@code str} string.
Do escaping of whitespace to preserve spatial formatting. We use character
entity #160 to make it safer for xml.
@param {string} str The string in which to escape whitespace.
@param {bool=} opt_xml Whether to use XML compatible tags.
@return {string} An escaped copy of {@code str}.