You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
81 KiB
188 lines
81 KiB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.string</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.string</h1><a class="source" href="source/lib/goog/string/string.js.src.html#l23">code »</a></header><section></section><section><h2>Enumerations</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="enum_goog_string_Unicode.html">goog.string.Unicode</a><dd>Common Unicode string characters.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1139">code »</a><span class="member"><a name="goog.string.buildString">goog.string.buildString</a> <span class="args">( var_args )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Concatenates string expressions. This is useful
|
|
since some browsers are very inefficient when it comes to using plus to
|
|
concat strings. Be careful when using null and undefined here since
|
|
these will not be included in the result. If you need to represent these
|
|
be sure to cast the argument to a String first.
|
|
For example:
|
|
<pre>buildString('a', 'b', 'c', 'd') -> 'abcd'
|
|
buildString(null, undefined) -> ''
|
|
</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...*</code><dd>A list of strings to concatenate. If not a string,
|
|
it will be casted to one.</dl><tr><th>Returns<tr><td><dl>The concatenation of <code >var_args</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l246">code »</a><span class="member"><a name="goog.string.canonicalizeNewlines">goog.string.canonicalizeNewlines</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Replaces Windows and Mac new lines with unix style: \r or \r\n with \n.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to in which to canonicalize newlines.</dl><tr><th>Returns<tr><td><dl><code >str</code> A copy of {@code} with canonicalized newlines.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l336">code »</a><span class="member"><a name="goog.string.caseInsensitiveCompare">goog.string.caseInsensitiveCompare</a> <span class="args">( str1, str2 )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>A string comparator that ignores case.
|
|
-1 = str1 less than str2
|
|
0 = str1 equals str2
|
|
1 = str1 greater than str2</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str1: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to compare.<dt>str2: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to compare <code >str1</code> to.</dl><tr><th>Returns<tr><td><dl>The comparator result, as described above.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1003">code »</a><span class="member"><a name="goog.string.caseInsensitiveContains">goog.string.caseInsensitiveContains</a> <span class="args">( str, subString )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Determines whether a string contains a substring, ignoring case.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to search.<dt>subString: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The substring to search for.</dl><tr><th>Returns<tr><td><dl>Whether <code >str</code> contains <code >subString</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l86">code »</a><span class="member"><a name="goog.string.caseInsensitiveEndsWith">goog.string.caseInsensitiveEndsWith</a> <span class="args">( str, suffix )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Case-insensitive suffix-checker.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.<dt>suffix: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string to look for at the end of <code >str</code>.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> ends with <code >suffix</code> (ignoring
|
|
case).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l99">code »</a><span class="member"><a name="goog.string.caseInsensitiveEquals">goog.string.caseInsensitiveEquals</a> <span class="args">( str1, str2 )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Case-insensitive equality checker.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str1: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>First string to check.<dt>str2: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Second string to check.</dl><tr><th>Returns<tr><td><dl>True if <code >str1</code> and <code >str2</code> are the same string,
|
|
ignoring case.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l73">code »</a><span class="member"><a name="goog.string.caseInsensitiveStartsWith">goog.string.caseInsensitiveStartsWith</a> <span class="args">( str, prefix )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Case-insensitive prefix-checker.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.<dt>prefix: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string to look for at the end of <code >str</code>.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> begins with <code >prefix</code> (ignoring
|
|
case).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l281">code »</a><span class="member"><a name="goog.string.collapseBreakingSpaces">goog.string.collapseBreakingSpaces</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Removes the breaking spaces from the left and right of the string and
|
|
collapses the sequences of breaking spaces in the middle into single spaces.
|
|
The original and the result strings render the same way in HTML.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string in which to collapse spaces.</dl><tr><th>Returns<tr><td><dl>Copy of the string with normalized breaking spaces.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l134">code »</a><span class="member"><a name="goog.string.collapseWhitespace">goog.string.collapseWhitespace</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Converts multiple whitespace chars (spaces, non-breaking-spaces, new lines
|
|
and tabs) to a single space, and strips leading and trailing whitespace.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Input string.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> with collapsed whitespace.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1228">code »</a><span class="member"><a name="goog.string.compareElements_">goog.string.compareElements_</a> <span class="args">( left, right )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Compares elements of a version number.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>left: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code><dd>An element from a version number.<dt>right: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code><dd>An element from a version number.</dl><tr><th>Returns<tr><td><dl>1 if <code >left</code> is higher.
|
|
0 if arguments are equal.
|
|
-1 if <code >right</code> is higher.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1170">code »</a><span class="member"><a name="goog.string.compareVersions">goog.string.compareVersions</a> <span class="args">( version1, version2 )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Compares two version numbers.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>version1: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)</code><dd>Version of first item.<dt>version2: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)</code><dd>Version of second item.</dl><tr><th>Returns<tr><td><dl>1 if <code >version1</code> is higher.
|
|
0 if arguments are equal.
|
|
-1 if <code >version2</code> is higher.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l992">code »</a><span class="member"><a name="goog.string.contains">goog.string.contains</a> <span class="args">( str, subString )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Determines whether a string contains a substring.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to search.<dt>subString: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The substring to search for.</dl><tr><th>Returns<tr><td><dl>Whether <code >str</code> contains <code >subString</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1015">code »</a><span class="member"><a name="goog.string.countOf">goog.string.countOf</a> <span class="args">( s, ss )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the non-overlapping occurrences of ss in s.
|
|
If either s or ss evalutes to false, then returns zero.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to look in.<dt>ss: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to look for.</dl><tr><th>Returns<tr><td><dl>Number of occurrences of ss in s.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1281">code »</a><span class="member"><a name="goog.string.createUniqueString">goog.string.createUniqueString</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Generates and returns a string which is unique in the current document.
|
|
This is useful, for example, to create unique IDs for DOM elements.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A unique id.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l60">code »</a><span class="member"><a name="goog.string.endsWith">goog.string.endsWith</a> <span class="args">( str, suffix )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Fast suffix-checker.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.<dt>suffix: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string to look for at the end of <code >str</code>.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> ends with <code >suffix</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l935">code »</a><span class="member"><a name="goog.string.escapeChar">goog.string.escapeChar</a> <span class="args">( c )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Takes a character and returns the escaped string for that character. For
|
|
example escapeChar(String.fromCharCode(15)) -> "\\x0E".</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>c: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The character to escape.</dl><tr><th>Returns<tr><td><dl>An escaped string representing <code >c</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l920">code »</a><span class="member"><a name="goog.string.escapeString">goog.string.escapeString</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Takes a string and returns the escaped string for that character.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to escape.</dl><tr><th>Returns<tr><td><dl>An escaped string representing <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1153">code »</a><span class="member"><a name="goog.string.getRandomString">goog.string.getRandomString</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a string with at least 64-bits of randomness.
|
|
|
|
Doesn't trust Javascript's random function entirely. Uses a combination of
|
|
random and current timestamp, and then encodes the string in base-36 to
|
|
make it shorter.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A random string, e.g. sn1s7vb4gcic.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1257">code »</a><span class="member"><a name="goog.string.hashCode">goog.string.hashCode</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>String hash function similar to java.lang.String.hashCode().
|
|
The hash code for a string is computed as
|
|
s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
|
|
where s[i] is the ith character of the string and n is the length of
|
|
the string. We mod the result to make it between 0 (inclusive) and 2^32
|
|
(exclusive).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string.</dl><tr><th>Returns<tr><td><dl>Hash value for <code >str</code>, between 0 (inclusive) and 2^32
|
|
(exclusive). The empty string returns 0.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l503">code »</a><span class="member"><a name="goog.string.htmlEscape">goog.string.htmlEscape</a> <span class="args">( str, opt_isLikelyToContainHtmlChars )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>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.
|
|
|
|
It should be noted that > doesn't need to be escaped for the HTML or XML to
|
|
be valid, but it has been decided to escape it for consistency with other
|
|
implementations.
|
|
|
|
With goog.string.DETECT_DOUBLE_ESCAPING, this function escapes also the
|
|
lowercase letter "e".
|
|
|
|
NOTE(user):
|
|
HtmlEscape is often called during the generation of large blocks of HTML.
|
|
Using statics for the regular expressions and strings is an optimization
|
|
that can more than half the amount of time IE spends in this function for
|
|
large apps, since strings and regexes both contribute to GC allocations.
|
|
|
|
Testing for the presence of a character before escaping increases the number
|
|
of function calls, but actually provides a speed increase for the average
|
|
case -- since the average case often doesn't require the escaping of all 4
|
|
characters and indexOf() is much cheaper than replace().
|
|
The worst case does suffer slightly from the additional calls, therefore the
|
|
opt_isLikelyToContainHtmlChars option has been included for situations
|
|
where all 4 HTML entities are very likely to be present and need escaping.
|
|
|
|
Some benchmarks (times tended to fluctuate +-0.05ms):
|
|
FireFox IE6
|
|
(no chars / average (mix of cases) / all 4 chars)
|
|
no checks 0.13 / 0.22 / 0.22 0.23 / 0.53 / 0.80
|
|
indexOf 0.08 / 0.17 / 0.26 0.22 / 0.54 / 0.84
|
|
indexOf + re test 0.07 / 0.17 / 0.28 0.19 / 0.50 / 0.85
|
|
|
|
An additional advantage of checking if replace actually needs to be called
|
|
is a reduction in the number of object allocations, so as the size of the
|
|
application grows the difference between the various methods would increase.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>string to be escaped.<dt>opt_isLikelyToContainHtmlChars: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Don't perform a check to see
|
|
if the character needs replacing - use this option if you expect each of
|
|
the characters to appear often. Leave false if you expect few html
|
|
characters to occur in your strings, such as if you are escaping HTML.</dl><tr><th>Returns<tr><td><dl>An escaped copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l183">code »</a><span class="member"><a name="goog.string.isAlpha">goog.string.isAlpha</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string contains all letters.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>string to check.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> consists entirely of letters.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l204">code »</a><span class="member"><a name="goog.string.isAlphaNumeric">goog.string.isAlphaNumeric</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string contains only numbers or letters.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>string to check.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> is alphanumeric.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l173">code »</a><span class="member"><a name="goog.string.isBreakingWhitespace">goog.string.isBreakingWhitespace</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string is all breaking whitespace.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.</dl><tr><th>Returns<tr><td><dl>Whether the string is all breaking whitespace.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l147">code »</a><span class="member"><a name="goog.string.isEmpty">goog.string.isEmpty</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string is empty or contains only whitespaces.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> is empty or whitespace only.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l163">code »</a><span class="member"><a name="goog.string.isEmptySafe">goog.string.isEmptySafe</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string is null, undefined, empty or contains only whitespaces.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type">*</code><dd>The string to check.</dl><tr><th>Returns<tr><td><dl>True if<code >str</code> is null, undefined, empty, or
|
|
whitespace only.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1315">code »</a><span class="member"><a name="goog.string.isLowerCamelCase">goog.string.isLowerCamelCase</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the given string is lower camel case (e.g. "isFooBar").
|
|
|
|
Note that this assumes the string is entirely letters.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>String to test.</dl><tr><th>Returns<tr><td><dl>Whether the string is lower camel case.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l194">code »</a><span class="member"><a name="goog.string.isNumeric">goog.string.isNumeric</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a string contains only numbers.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type">*</code><dd>string to check. If not a string, it will be
|
|
casted to one.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> is numeric.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l214">code »</a><span class="member"><a name="goog.string.isSpace">goog.string.isSpace</a> <span class="args">( ch )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a character is a space character.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>ch: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Character to check.</dl><tr><th>Returns<tr><td><dl>True if {code ch} is a space.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l224">code »</a><span class="member"><a name="goog.string.isUnicodeChar">goog.string.isUnicodeChar</a> <span class="args">( ch )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Checks if a character is a valid unicode character.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>ch: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Character to check.</dl><tr><th>Returns<tr><td><dl>True if {code ch} is a valid unicode character.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1329">code »</a><span class="member"><a name="goog.string.isUpperCamelCase">goog.string.isUpperCamelCase</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the given string is upper camel case (e.g. "FooBarBaz").
|
|
|
|
Note that this assumes the string is entirely letters.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>String to test.</dl><tr><th>Returns<tr><td><dl>Whether the string is upper camel case.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1120">code »</a><span class="member"><a name="goog.string.makeSafe">goog.string.makeSafe</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a string representation of the given object, with
|
|
null and undefined being returned as the empty string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">*</code><dd>The object to convert.</dl><tr><th>Returns<tr><td><dl>A string representation of the <code >obj</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l454">code »</a><span class="member"><a name="goog.string.newLineToBr">goog.string.newLineToBr</a> <span class="args">( str, opt_xml )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Converts \n to <br>s or <br />s.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in which to convert newlines.<dt>opt_xml: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to use XML compatible tags.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> with converted newlines.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l269">code »</a><span class="member"><a name="goog.string.normalizeSpaces">goog.string.normalizeSpaces</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Normalizes spaces in a string, replacing all consecutive spaces and tabs
|
|
with a single space. Replaces non-breaking space with a space.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in which to normalize spaces.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> with all consecutive spaces and tabs
|
|
replaced with a single space.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l257">code »</a><span class="member"><a name="goog.string.normalizeWhitespace">goog.string.normalizeWhitespace</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Normalizes whitespace in a string, replacing all whitespace chars with
|
|
a space.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in which to normalize whitespace.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> with all whitespace normalized.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l375">code »</a><span class="member"><a name="goog.string.numerateCompare">goog.string.numerateCompare</a> <span class="args">( str1, str2 )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>String comparison function that handles numbers in a way humans might expect.
|
|
Using this function, the string "File 2.jpg" sorts before "File 10.jpg". The
|
|
comparison is mostly case-insensitive, though strings that are identical
|
|
except for case are sorted with the upper-case strings before lower-case.
|
|
|
|
This comparison function is significantly slower (about 500x) than either
|
|
the default or the case-insensitive compare. It should not be used in
|
|
time-critical code, but should be fast enough to sort several hundred short
|
|
strings (like filenames) with a reasonable delay.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str1: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to compare in a numerically sensitive way.<dt>str2: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to compare <code >str1</code> to.</dl><tr><th>Returns<tr><td><dl>less than 0 if str1 < str2, 0 if str1 == str2, greater than
|
|
0 if str1 > str2.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1103">code »</a><span class="member"><a name="goog.string.padNumber">goog.string.padNumber</a> <span class="args">( num, length, opt_precision )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Pads number to given length and optionally rounds it to a given precision.
|
|
For example:
|
|
<pre>padNumber(1.25, 2, 3) -> '01.250'
|
|
padNumber(1.25, 2) -> '01.25'
|
|
padNumber(1.25, 2, 1) -> '01.3'
|
|
padNumber(1.25, 0) -> '1.25'</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number to pad.<dt>length: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The desired length.<dt>opt_precision: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The desired precision.</dl><tr><th>Returns<tr><td><dl><code >num</code> as a string with the given options.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1423">code »</a><span class="member"><a name="goog.string.parseInt">goog.string.parseInt</a> <span class="args">( value )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Parse a string in decimal or hexidecimal ('0xFFFF') form.
|
|
|
|
To parse a particular radix, please use parseInt(string, radix) directly. See
|
|
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt
|
|
|
|
This is a wrapper for the built-in parseInt function that will only parse
|
|
numbers as base 10 or base 16. Some JS implementations assume strings
|
|
starting with "0" are intended to be octal. ES3 allowed but discouraged
|
|
this behavior. ES5 forbids it. This function emulates the ES5 behavior.
|
|
|
|
For more information, see Mozilla JS Reference: http://goo.gl/8RiFj</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>value: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code><dd>The value to be parsed.</dl><tr><th>Returns<tr><td><dl>The number, parsed. If the string failed to parse, this
|
|
will be NaN.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l763">code »</a><span class="member"><a name="goog.string.preserveSpaces">goog.string.preserveSpaces</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Preserve spaces that would be otherwise collapsed in HTML by replacing them
|
|
with non-breaking space Unicode characters.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in which to preserve whitespace.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> with preserved whitespace.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l897">code »</a><span class="member"><a name="goog.string.quote">goog.string.quote</a> <span class="args">( s )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Encloses a string in double quotes and escapes characters so that the
|
|
string is a valid JS string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to quote.</dl><tr><th>Returns<tr><td><dl>A copy of <code >s</code> surrounded by double quotes.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1072">code »</a><span class="member"><a name="goog.string.regExpEscape">goog.string.regExpEscape</a> <span class="args">( s )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Escapes characters in the string that are not safe to use in a RegExp.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type">*</code><dd>The string to escape. If not a string, it will be casted
|
|
to one.</dl><tr><th>Returns<tr><td><dl>A RegExp safe, escaped copy of <code >s</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1047">code »</a><span class="member"><a name="goog.string.remove">goog.string.remove</a> <span class="args">( s, ss )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Removes the first occurrence of a substring from a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The base string from which to remove.<dt>ss: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to remove.</dl><tr><th>Returns<tr><td><dl>A copy of <code >s</code> with <code >ss</code> removed or the full
|
|
string if nothing is removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1060">code »</a><span class="member"><a name="goog.string.removeAll">goog.string.removeAll</a> <span class="args">( s, ss )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Removes all occurrences of a substring from a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The base string from which to remove.<dt>ss: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to remove.</dl><tr><th>Returns<tr><td><dl>A copy of <code >s</code> with <code >ss</code> removed or the full
|
|
string if nothing is removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1029">code »</a><span class="member"><a name="goog.string.removeAt">goog.string.removeAt</a> <span class="args">( s, index, stringLength )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Removes a substring of a specified length at a specific
|
|
index in a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The base string from which to remove.<dt>index: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The index at which to remove the substring.<dt>stringLength: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The length of the substring to remove.</dl><tr><th>Returns<tr><td><dl>A copy of <code >s</code> with the substring removed or the full
|
|
string if nothing is removed or the input is invalid.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1085">code »</a><span class="member"><a name="goog.string.repeat">goog.string.repeat</a> <span class="args">( string, length )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Repeats a string n times.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>string: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to repeat.<dt>length: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number of times to repeat.</dl><tr><th>Returns<tr><td><dl>A string containing <code >length</code> repetitions of
|
|
<code >string</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1458">code »</a><span class="member"><a name="goog.string.splitLimit">goog.string.splitLimit</a> <span class="args">( str, separator, limit )</span> ⇒ <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>Splits a string on a separator a limited number of times.
|
|
|
|
This implementation is more similar to Python or Java, where the limit
|
|
parameter specifies the maximum number of splits rather than truncating
|
|
the number of results.
|
|
|
|
See http://docs.python.org/2/library/stdtypes.html#str.split
|
|
See JavaDoc: http://goo.gl/F2AsY
|
|
See Mozilla reference: http://goo.gl/dZdZs</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>String to split.<dt>separator: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The separator.<dt>limit: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The limit to the number of splits. The resulting array
|
|
will have a maximum length of limit+1. Negative numbers are the same
|
|
as zero.</dl><tr><th>Returns<tr><td><dl>The string, split.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l49">code »</a><span class="member"><a name="goog.string.startsWith">goog.string.startsWith</a> <span class="args">( str, prefix )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Fast prefix-checker.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to check.<dt>prefix: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A string to look for at the start of <code >str</code>.</dl><tr><th>Returns<tr><td><dl>True if <code >str</code> begins with <code >prefix</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l236">code »</a><span class="member"><a name="goog.string.stripNewlines">goog.string.stripNewlines</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Takes a string and replaces newlines with a space. Multiple lines are
|
|
replaced with a single space.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string from which to strip newlines.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> stripped of newlines.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l783">code »</a><span class="member"><a name="goog.string.stripQuotes">goog.string.stripQuotes</a> <span class="args">( str, quoteChars )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Strip quote characters around a string. The second argument is a string of
|
|
characters to treat as quotes. This can be a single character or a string of
|
|
multiple character and in that case each of those are treated as possible
|
|
quote characters. For example:
|
|
|
|
<pre>
|
|
goog.string.stripQuotes('"abc"', '"`') --> 'abc'
|
|
goog.string.stripQuotes('`abc`', '"`') --> 'abc'
|
|
</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to strip.<dt>quoteChars: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The quote characters to strip.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> without the quotes.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l112">code »</a><span class="member"><a name="goog.string.subs">goog.string.subs</a> <span class="args">( str, var_args )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Does simple python-style string substitution.
|
|
subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog".</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string containing the pattern.<dt>var_args: <code class="type">...*</code><dd>The items to substitute into the pattern.</dl><tr><th>Returns<tr><td><dl>A copy of <code >str</code> in which each occurrence of
|
|
<code >%s</code> has been replaced an argument from <code >var_args</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1341">code »</a><span class="member"><a name="goog.string.toCamelCase">goog.string.toCamelCase</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Converts a string from selector-case to camelCase (e.g. from
|
|
"multi-part-string" to "multiPartString"), useful for converting
|
|
CSS selectors and HTML dataset keys to their equivalent JS properties.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in selector-case form.</dl><tr><th>Returns<tr><td><dl>The string in camelCase form.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l977">code »</a><span class="member"><a name="goog.string.toMap">goog.string.toMap</a> <span class="args">( s )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Takes a string and creates a map (Object) in which the keys are the
|
|
characters in the string. The value for the key is set to true. You can
|
|
then use goog.object.map or goog.array.map to change the values.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to build the map from.</dl><tr><th>Returns<tr><td><dl>The map of characters used.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1297">code »</a><span class="member"><a name="goog.string.toNumber">goog.string.toNumber</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Converts the supplied string to a number, which may be Infinity or NaN.
|
|
This function strips whitespace: (toNumber(' 123') === 123)
|
|
This function accepts scientific notation: (toNumber('1e1') === 10)
|
|
|
|
This is better than Javascript's built-in conversions because, sadly:
|
|
(Number(' ') === 0) and (parseFloat('123a') === 123)</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to convert.</dl><tr><th>Returns<tr><td><dl>The number the supplied string represents, or NaN.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1355">code »</a><span class="member"><a name="goog.string.toSelectorCase">goog.string.toSelectorCase</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Converts a string from camelCase to selector-case (e.g. from
|
|
"multiPartString" to "multi-part-string"), useful for converting JS
|
|
style and dataset properties to equivalent CSS selectors and HTML keys.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in camelCase form.</dl><tr><th>Returns<tr><td><dl>The string in selector-case form.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1391">code »</a><span class="member"><a name="goog.string.toTitleCase">goog.string.toTitleCase</a> <span class="args">( str, opt_delimiters )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Converts a string into TitleCase. First character of the string is always
|
|
capitalized in addition to the first letter of every subsequent word.
|
|
Words are delimited by one or more whitespaces by default. Custom delimiters
|
|
can optionally be specified to replace the default, which doesn't preserve
|
|
whitespace delimiters and instead must be explicitly included if needed.
|
|
|
|
Default delimiter => " ":
|
|
goog.string.toTitleCase('oneTwoThree') => 'OneTwoThree'
|
|
goog.string.toTitleCase('one two three') => 'One Two Three'
|
|
goog.string.toTitleCase(' one two ') => ' One Two '
|
|
goog.string.toTitleCase('one_two_three') => 'One_two_three'
|
|
goog.string.toTitleCase('one-two-three') => 'One-two-three'
|
|
|
|
Custom delimiter => "_-.":
|
|
goog.string.toTitleCase('oneTwoThree', '_-.') => 'OneTwoThree'
|
|
goog.string.toTitleCase('one two three', '_-.') => 'One two three'
|
|
goog.string.toTitleCase(' one two ', '_-.') => ' one two '
|
|
goog.string.toTitleCase('one_two_three', '_-.') => 'One_Two_Three'
|
|
goog.string.toTitleCase('one-two-three', '_-.') => 'One-Two-Three'
|
|
goog.string.toTitleCase('one...two...three', '_-.') => 'One...Two...Three'
|
|
goog.string.toTitleCase('one. two. three', '_-.') => 'One. two. three'
|
|
goog.string.toTitleCase('one-two.three', '_-.') => 'One-Two.Three'</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>String value in camelCase form.<dt>opt_delimiters: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Custom delimiter character set used to
|
|
distinguish words in the string value. Each character represents a
|
|
single delimiter. When provided, default whitespace delimiter is
|
|
overridden and must be explicitly included if needed.</dl><tr><th>Returns<tr><td><dl>String value in TitleCase form.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l292">code »</a><span class="member"><a name="goog.string.trim">goog.string.trim</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Trims white spaces to the left and right of a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to trim.</dl><tr><th>Returns<tr><td><dl>A trimmed copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l305">code »</a><span class="member"><a name="goog.string.trimLeft">goog.string.trimLeft</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Trims whitespaces at the left end of a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to left trim.</dl><tr><th>Returns<tr><td><dl>A trimmed copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l318">code »</a><span class="member"><a name="goog.string.trimRight">goog.string.trimRight</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Trims whitespaces at the right end of a string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to right trim.</dl><tr><th>Returns<tr><td><dl>A trimmed copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l805">code »</a><span class="member"><a name="goog.string.truncate">goog.string.truncate</a> <span class="args">( str, chars, opt_protectEscapedCharacters )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>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...'.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to truncate.<dt>chars: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Max number of characters.<dt>opt_protectEscapedCharacters: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to protect escaped
|
|
characters from being cut off in the middle.</dl><tr><th>Returns<tr><td><dl>The truncated <code >str</code> string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l834">code »</a><span class="member"><a name="goog.string.truncateMiddle">goog.string.truncateMiddle</a> <span class="args">( str, chars, opt_protectEscapedCharacters, opt_trailingChars )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Truncate a string in the middle, adding "..." if necessary,
|
|
and favoring the beginning of the string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to truncate the middle of.<dt>chars: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Max number of characters.<dt>opt_protectEscapedCharacters: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to protect escaped
|
|
characters from being cutoff in the middle.<dt>opt_trailingChars: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Optional number of trailing characters to
|
|
leave at the end of the string, instead of truncating as close to the
|
|
middle as possible.</dl><tr><th>Returns<tr><td><dl>A truncated copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l621">code »</a><span class="member"><a name="goog.string.unescapeEntities">goog.string.unescapeEntities</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Unescapes an HTML string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to unescape.</dl><tr><th>Returns<tr><td><dl>An unescaped copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l662">code »</a><span class="member"><a name="goog.string.unescapeEntitiesUsingDom_">goog.string.unescapeEntitiesUsingDom_</a> <span class="args">( str, opt_document )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Unescapes an HTML string using a DOM to resolve non-XML, non-numeric
|
|
entities. This function is XSS-safe and whitespace-preserving.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to unescape.<dt>opt_document: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>=</code><dd>An optional document to use for creating
|
|
elements. If this is not specified then the default window.document
|
|
will be used.</dl><tr><th>Returns<tr><td><dl>The unescaped <code >str</code> string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l644">code »</a><span class="member"><a name="goog.string.unescapeEntitiesWithDocument">goog.string.unescapeEntitiesWithDocument</a> <span class="args">( str, document )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Unescapes a HTML string using the provided document.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to unescape.<dt>document: <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a></code><dd>A document to use in escaping the string.</dl><tr><th>Returns<tr><td><dl>An unescaped copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l709">code »</a><span class="member"><a name="goog.string.unescapePureXmlEntities_">goog.string.unescapePureXmlEntities_</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Unescapes XML entities.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to unescape.</dl><tr><th>Returns<tr><td><dl>An unescaped copy of <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l443">code »</a><span class="member"><a name="goog.string.urlDecode">goog.string.urlDecode</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>URL-decodes the string. We need to specially handle '+'s because
|
|
the javascript library doesn't convert them to spaces.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to url decode.</dl><tr><th>Returns<tr><td><dl>The decoded <code >str</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l432">code »</a><span class="member"><a name="goog.string.urlEncode">goog.string.urlEncode</a> <span class="args">( str )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>URL-encodes a string</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type">*</code><dd>The string to url-encode.</dl><tr><th>Returns<tr><td><dl>An encoded copy of <code >str</code> that is safe for urls.
|
|
Note that '#', ':', and other characters used to delimit portions
|
|
of URLs *will* be encoded.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l751">code »</a><span class="member"><a name="goog.string.whitespaceEscape">goog.string.whitespaceEscape</a> <span class="args">( str, opt_xml )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Do escaping of whitespace to preserve spatial formatting. We use character
|
|
entity #160 to make it safer for xml.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string in which to escape whitespace.<dt>opt_xml: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to use XML compatible tags.</dl><tr><th>Returns<tr><td><dl>An escaped copy of <code >str</code>.</dl></table></div></details></div></div></section><section id="static-properties"><h2>Global Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l610">code »</a><span class="member"><a name="goog.string.ALL_RE_">goog.string.ALL_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches any character that needs to be escaped.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l554">code »</a><span class="member"><a name="goog.string.AMP_RE_">goog.string.AMP_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches an ampersand, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l602">code »</a><span class="member"><a name="goog.string.E_RE_">goog.string.E_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches a lowercase letter "e", for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l570">code »</a><span class="member"><a name="goog.string.GT_RE_">goog.string.GT_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches a greater than sign, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1243">code »</a><span class="member"><a name="goog.string.HASHCODE_MAX_">goog.string.HASHCODE_MAX_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Maximum value of #goog.string.hashCode, exclusive. 2^32.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l741">code »</a><span class="member"><a name="goog.string.HTML_ENTITY_PATTERN_">goog.string.HTML_ENTITY_PATTERN_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches an HTML entity.
|
|
See also HTML5: Tokenization / Tokenizing character references.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l562">code »</a><span class="member"><a name="goog.string.LT_RE_">goog.string.LT_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches a less than sign, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l594">code »</a><span class="member"><a name="goog.string.NULL_RE_">goog.string.NULL_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches null character, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l578">code »</a><span class="member"><a name="goog.string.QUOT_RE_">goog.string.QUOT_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches a double quote, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l586">code »</a><span class="member"><a name="goog.string.SINGLE_QUOTE_RE_">goog.string.SINGLE_QUOTE_RE_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression that matches a single quote, for use in escaping.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l886">code »</a><span class="member"><a name="goog.string.jsEscapeCache_">goog.string.jsEscapeCache_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Character mappings used internally for goog.string.escapeChar.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l356">code »</a><span class="member"><a name="goog.string.numerateCompareRegExp_">goog.string.numerateCompareRegExp_</a> : <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></code></span></div><p>Regular expression used for splitting a string into substrings of fractional
|
|
numbers, integers, and non-numeric characters.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l868">code »</a><span class="member"><a name="goog.string.specialEscapeChars_">goog.string.specialEscapeChars_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Special chars that need to be escaped for goog.string.quote.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l1273">code »</a><span class="member"><a name="goog.string.uniqueStringCounter_">goog.string.uniqueStringCounter_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>The most recent unique ID. |0 is equivalent to Math.floor in this case.</summary></details></div></div></section><section id="compiler-constants"><h2>Compiler Constants</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/string/string.js.src.html#l31">code »</a><span class="member"><a name="goog.string.DETECT_DOUBLE_ESCAPING">goog.string.DETECT_DOUBLE_ESCAPING</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script> |