1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery tablesorter - Named Numbers Parser</title>
<!-- jQuery -->
<script src="js/jquery-latest.min.js"></script>
<!-- Demo stuff -->
<link rel="stylesheet" href="css/jq.css">
<link href="css/prettify.css" rel="stylesheet">
<script src="js/prettify.js"></script>
<script src="js/docs.js"></script>
<style>
th { width: 33%; }
</style>
<link href="../css/theme.blue.css" rel="stylesheet">
<script src="../js/jquery.tablesorter.js"></script>
<!-- load metric parser -->
<script src="../js/parsers/parser-named-numbers.js"></script>
<script src="../js/parsers/parser-huge-numbers.js"></script>
<script id="js">$(function() {
$("table").tablesorter({
theme : 'blue',
widgets : ["zebra"]
});
});</script>
</head>
<body>
<div id="banner">
<h1>table<em>sorter</em></h1>
<h2>Named Numbers Parser</h2>
<h3>Flexible client-side table sorting</h3>
<a href="index.html">Back to documentation</a>
</div>
<div id="main">
<p class="tip">
<em>NOTE!</em>
</p>
<ul>
<li>In <span class="version">v2.25.5</span>, added an example that uses the huge number parser.
<ul>
<li>The largest number (<code>MAX_SAFE_INTEGER</code>) that javascript can handle is <code>9,007,199,254,740,991</code>.</li>
<li>Anything larger and the number gets rounded off, so that's why this parser was created.</li>
</ul>
</li>
<li>In <span class="version updated">v2.22.0</span>, this parser will now ignore commas, periods and quotes adjacent to the named number word (e.g. "10 million, three...").</li>
<li>This parser will convert named numbers into appropriate values so they are sorted correctly.</li>
<li>Named numbers include values:
<ul>
<li>zero to twenty; by one ("one", "two", "three", ..., "nineteen", "twenty")</li>
<li>twenty to hundred; by ten ("twenty", "thirty", "forty", ... "ninety", "hundred")</li>
<li>thousand (1e3) to duotrigintillion (1e99); by 10^(3n+3) value ("thousand", "million", "billion", ... "untrigintillion", "duotrigintillion")</li>
<li>googl (1e100)</li>
</ul>
</li>
<li>Even bigger named values will need to be manually added to the parser code; see <a href="http://en.wikipedia.org/wiki/Names_of_large_numbers">this wikipedia page</a> for more names.</li>
</ul>
<h1>Demo</h1>
<button type="button" class="toggleparsedvalue">Toggle parsed values</button>
<div id="demo"><table class="tablesorter">
<thead>
<tr>
<th class="sorter-namedNumbers">Numbers</th>
<th class="sorter-namedNumbers">Large Numbers</th>
<th class="sorter-hugeNumbers">Huge Numbers</th>
</tr>
</thead>
<tbody>
<tr>
<td>5 hundred</td>
<td>one hundred and fifty two million</td>
<td>110,000,000,000,000,001</td>
</tr>
<tr>
<td>four hundred thousand five hundred fourty three</td>
<td>710,231,000</td>
<td>110,000,000,000,000,000</td>
</tr>
<tr>
<td>one hundred and fifty five</td>
<td>10 million, three hundred sixty five thousand, four hundred and ninety one</td>
<td>110,000,000,000,000,005</td>
</tr>
<tr>
<td>negative twelve</td>
<td>10 million and three</td>
<td>110,000,000,000,000,003</td>
</tr>
<tr>
<td>minus three hundred and fifty seven thousand four hundred and two</td>
<td>6 billion eight thousand</td>
<td>110,000,000,000,000,012</td>
</tr>
<tr>
<td>zero</td>
<td>3 hundred quadrillion</td>
<td>110,000,000,000,000,002</td>
</tr>
<tr>
<td>three hundred twenty</td>
<td>145 decillion</td>
<td>110,000,000,000,000,010</td>
</tr>
<tr>
<td>forty-two</td>
<td>700 thousand</td>
<td>110,000,000,000,000,007</td>
</tr>
<tr>
<td>ninety-nine thousand nine hundred and ninety-nine</td>
<td>2.3 million</td>
<td>110,000,000,000,000,009</td>
</tr>
<tr>
<td>2.3 thousand</td>
<td>2.3 googl</td>
<td>110,000,000,000,000,008</td>
</tr>
<tr>
<td>minus one</td>
<td>8 hundred thousand</td>
<td>110,000,000,000,000,021</td>
</tr>
<tr>
<td>seven hundred fifty two</td>
<td>9 hundred-million</td>
<td>110,000,000,000,000,011</td>
</tr>
<tr>
<td>one hundred and thirty-three</td>
<td>Twenty-three trillion</td>
<td>110,000,000,000,000,100</td>
</tr>
</tbody>
</table></div>
<h1>Page Header</h1>
<div>
<pre class="prettyprint lang-html"><!-- blue theme stylesheet with additional css styles added in v2.0.17 -->
<link rel="stylesheet" href="../css/theme.blue.css">
<!-- tablesorter plugin -->
<script src="../js/jquery.tablesorter.js"></script>
<!-- load metric parser -->
<script src="../js/parsers/parser-named-numbers.js"></script></pre>
</div>
<h1>Javascript</h1>
<div id="javascript">
<pre class="prettyprint lang-javascript"></pre>
</div>
<h1>HTML</h1>
<div id="html">
<pre class="prettyprint lang-html"></pre>
</div>
</div>
<script>
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [0,1]);
});
</script>
</body>
</html>
|