1 | /*
|
2 | string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
|
3 | */
|
4 |
|
5 | !(function() {
|
6 | ;
|
7 |
|
8 | var VERSION = '3.3.3';
|
9 |
|
10 | var ENTITIES = {};
|
11 |
|
12 | // from http://semplicewebsites.com/removing-accents-javascript
|
13 | var latin_map={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","Ꞇ":"T","Ꝭ":"IS","Ĵ":"J","Ɉ":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","Ꝃ":"K","Ḳ":"K","Ƙ":"K","Ḵ":"K","Ꝁ":"K","Ꝅ":"K","Ĺ":"L","Ƚ":"L","Ľ":"L","Ļ":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","Ⱡ":"L","Ꝉ":"L","Ḻ":"L","Ŀ":"L","Ɫ":"L","Lj":"L","Ł":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ń":"N","Ň":"N","Ņ":"N","Ṋ":"N","Ṅ":"N","Ṇ":"N","Ǹ":"N","Ɲ":"N","Ṉ":"N","Ƞ":"N","Nj":"N","Ñ":"N","NJ":"NJ","Ó":"O","Ŏ":"O","Ǒ":"O","Ô":"O","Ố":"O","Ộ":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ö":"O","Ȫ":"O","Ȯ":"O","Ȱ":"O","Ọ":"O","Ő":"O","Ȍ":"O","Ò":"O","Ỏ":"O","Ơ":"O","Ớ":"O","Ợ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ȏ":"O","Ꝋ":"O","Ꝍ":"O","Ō":"O","Ṓ":"O","Ṑ":"O","Ɵ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Õ":"O","Ṍ":"O","Ṏ":"O","Ȭ":"O","Ƣ":"OI","Ꝏ":"OO","Ɛ":"E","Ɔ":"O","Ȣ":"OU","Ṕ":"P","Ṗ":"P","Ꝓ":"P","Ƥ":"P","Ꝕ":"P","Ᵽ":"P","Ꝑ":"P","Ꝙ":"Q","Ꝗ":"Q","Ŕ":"R","Ř":"R","Ŗ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ȑ":"R","Ȓ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꜿ":"C","Ǝ":"E","Ś":"S","Ṥ":"S","Š":"S","Ṧ":"S","Ş":"S","Ŝ":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṩ":"S","ẞ":"SS","Ť":"T","Ţ":"T","Ṱ":"T","Ț":"T","Ⱦ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","Ṯ":"T","Ʈ":"T","Ŧ":"T","Ɐ":"A","Ꞁ":"L","Ɯ":"M","Ʌ":"V","Ꜩ":"TZ","Ú":"U","Ŭ":"U","Ǔ":"U","Û":"U","Ṷ":"U","Ü":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ǖ":"U","Ṳ":"U","Ụ":"U","Ű":"U","Ȕ":"U","Ù":"U","Ủ":"U","Ư":"U","Ứ":"U","Ự":"U","Ừ":"U","Ử":"U","Ữ":"U","Ȗ":"U","Ū":"U","Ṻ":"U","Ų":"U","Ů":"U","Ũ":"U","Ṹ":"U","Ṵ":"U","Ꝟ":"V","Ṿ":"V","Ʋ":"V","Ṽ":"V","Ꝡ":"VY","Ẃ":"W","Ŵ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẁ":"W","Ⱳ":"W","Ẍ":"X","Ẋ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ẏ":"Y","Ỵ":"Y","Ỳ":"Y","Ƴ":"Y","Ỷ":"Y","Ỿ":"Y","Ȳ":"Y","Ɏ":"Y","Ỹ":"Y","Ź":"Z","Ž":"Z","Ẑ":"Z","Ⱬ":"Z","Ż":"Z","Ẓ":"Z","Ȥ":"Z","Ẕ":"Z","Ƶ":"Z","IJ":"IJ","Œ":"OE","ᴀ":"A","ᴁ":"AE","ʙ":"B","ᴃ":"B","ᴄ":"C","ᴅ":"D","ᴇ":"E","ꜰ":"F","ɢ":"G","ʛ":"G","ʜ":"H","ɪ":"I","ʁ":"R","ᴊ":"J","ᴋ":"K","ʟ":"L","ᴌ":"L","ᴍ":"M","ɴ":"N","ᴏ":"O","ɶ":"OE","ᴐ":"O","ᴕ":"OU","ᴘ":"P","ʀ":"R","ᴎ":"N","ᴙ":"R","ꜱ":"S","ᴛ":"T","ⱻ":"E","ᴚ":"R","ᴜ":"U","ᴠ":"V","ᴡ":"W","ʏ":"Y","ᴢ":"Z","á":"a","ă":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","ᶃ":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj","ſ":"s","ẜ":"s","ẛ":"s","ẝ":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ß":"ss","ᴑ":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","ꝸ":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","ᶌ":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"};
|
14 |
|
15 | //******************************************************************************
|
16 | // Added an initialize function which is essentially the code from the S
|
17 | // constructor. Now, the S constructor calls this and a new method named
|
18 | // setValue calls it as well. The setValue function allows constructors for
|
19 | // modules that extend string.js to set the initial value of an object without
|
20 | // knowing the internal workings of string.js.
|
21 | //
|
22 | // Also, all methods which return a new S object now call:
|
23 | //
|
24 | // return new this.constructor(s);
|
25 | //
|
26 | // instead of:
|
27 | //
|
28 | // return new S(s);
|
29 | //
|
30 | // This allows extended objects to keep their proper instanceOf and constructor.
|
31 | //******************************************************************************
|
32 |
|
33 | function initialize (object, s) {
|
34 | if (s !== null && s !== undefined) {
|
35 | if (typeof s === 'string')
|
36 | object.s = s;
|
37 | else
|
38 | object.s = s.toString();
|
39 | } else {
|
40 | object.s = s; //null or undefined
|
41 | }
|
42 |
|
43 | object.orig = s; //original object, currently only used by toCSV() and toBoolean()
|
44 |
|
45 | if (s !== null && s !== undefined) {
|
46 | if (object.__defineGetter__) {
|
47 | object.__defineGetter__('length', function() {
|
48 | return object.s.length;
|
49 | })
|
50 | } else {
|
51 | object.length = s.length;
|
52 | }
|
53 | } else {
|
54 | object.length = -1;
|
55 | }
|
56 | }
|
57 |
|
58 | function S(s) {
|
59 | initialize(this, s);
|
60 | }
|
61 |
|
62 | var __nsp = String.prototype;
|
63 | var __sp = S.prototype = {
|
64 |
|
65 | between: function(left, right) {
|
66 | var s = this.s;
|
67 | var startPos = s.indexOf(left);
|
68 | var endPos = s.indexOf(right, startPos + left.length);
|
69 | if (endPos == -1 && right != null)
|
70 | return new this.constructor('')
|
71 | else if (endPos == -1 && right == null)
|
72 | return new this.constructor(s.substring(startPos + left.length))
|
73 | else
|
74 | return new this.constructor(s.slice(startPos + left.length, endPos));
|
75 | },
|
76 |
|
77 | //# modified slightly from https://github.com/epeli/underscore.string
|
78 | camelize: function() {
|
79 | var s = this.trim().s.replace(/(\-|_|\s)+(.)?/g, function(mathc, sep, c) {
|
80 | return (c ? c.toUpperCase() : '');
|
81 | });
|
82 | return new this.constructor(s);
|
83 | },
|
84 |
|
85 | capitalize: function() {
|
86 | return new this.constructor(this.s.substr(0, 1).toUpperCase() + this.s.substring(1).toLowerCase());
|
87 | },
|
88 |
|
89 | charAt: function(index) {
|
90 | return this.s.charAt(index);
|
91 | },
|
92 |
|
93 | chompLeft: function(prefix) {
|
94 | var s = this.s;
|
95 | if (s.indexOf(prefix) === 0) {
|
96 | s = s.slice(prefix.length);
|
97 | return new this.constructor(s);
|
98 | } else {
|
99 | return this;
|
100 | }
|
101 | },
|
102 |
|
103 | chompRight: function(suffix) {
|
104 | if (this.endsWith(suffix)) {
|
105 | var s = this.s;
|
106 | s = s.slice(0, s.length - suffix.length);
|
107 | return new this.constructor(s);
|
108 | } else {
|
109 | return this;
|
110 | }
|
111 | },
|
112 |
|
113 | //#thanks Google
|
114 | collapseWhitespace: function() {
|
115 | var s = this.s.replace(/[\s\xa0]+/g, ' ').replace(/^\s+|\s+$/g, '');
|
116 | return new this.constructor(s);
|
117 | },
|
118 |
|
119 | contains: function(ss) {
|
120 | return this.s.indexOf(ss) >= 0;
|
121 | },
|
122 |
|
123 | count: function(ss) {
|
124 | return require('./_count')(this.s, ss)
|
125 | },
|
126 |
|
127 | //#modified from https://github.com/epeli/underscore.string
|
128 | dasherize: function() {
|
129 | var s = this.trim().s.replace(/[_\s]+/g, '-').replace(/([A-Z])/g, '-$1').replace(/-+/g, '-').toLowerCase();
|
130 | return new this.constructor(s);
|
131 | },
|
132 |
|
133 | equalsIgnoreCase: function(prefix) {
|
134 | var s = this.s;
|
135 | return s.toLowerCase() == prefix.toLowerCase()
|
136 | },
|
137 |
|
138 | latinise: function() {
|
139 | var s = this.replace(/[^A-Za-z0-9\[\] ]/g, function(x) { return latin_map[x] || x; });
|
140 | return new this.constructor(s);
|
141 | },
|
142 |
|
143 | decodeHtmlEntities: function() { //https://github.com/substack/node-ent/blob/master/index.js
|
144 | var s = this.s;
|
145 | s = s.replace(/&#(\d+);?/g, function (_, code) {
|
146 | return String.fromCharCode(code);
|
147 | })
|
148 | .replace(/&#[xX]([A-Fa-f0-9]+);?/g, function (_, hex) {
|
149 | return String.fromCharCode(parseInt(hex, 16));
|
150 | })
|
151 | .replace(/&([^;\W]+;?)/g, function (m, e) {
|
152 | var ee = e.replace(/;$/, '');
|
153 | var target = ENTITIES[e] || (e.match(/;$/) && ENTITIES[ee]);
|
154 |
|
155 | if (typeof target === 'number') {
|
156 | return String.fromCharCode(target);
|
157 | }
|
158 | else if (typeof target === 'string') {
|
159 | return target;
|
160 | }
|
161 | else {
|
162 | return m;
|
163 | }
|
164 | })
|
165 |
|
166 | return new this.constructor(s);
|
167 | },
|
168 |
|
169 | endsWith: function() {
|
170 | var suffixes = Array.prototype.slice.call(arguments, 0);
|
171 | for (var i = 0; i < suffixes.length; ++i) {
|
172 | var l = this.s.length - suffixes[i].length;
|
173 | if (l >= 0 && this.s.indexOf(suffixes[i], l) === l) return true;
|
174 | }
|
175 | return false;
|
176 | },
|
177 |
|
178 | escapeHTML: function() { //from underscore.string
|
179 | return new this.constructor(this.s.replace(/[&<>"']/g, function(m){ return '&' + reversedEscapeChars[m] + ';'; }));
|
180 | },
|
181 |
|
182 | ensureLeft: function(prefix) {
|
183 | var s = this.s;
|
184 | if (s.indexOf(prefix) === 0) {
|
185 | return this;
|
186 | } else {
|
187 | return new this.constructor(prefix + s);
|
188 | }
|
189 | },
|
190 |
|
191 | ensureRight: function(suffix) {
|
192 | var s = this.s;
|
193 | if (this.endsWith(suffix)) {
|
194 | return this;
|
195 | } else {
|
196 | return new this.constructor(s + suffix);
|
197 | }
|
198 | },
|
199 |
|
200 | humanize: function() { //modified from underscore.string
|
201 | if (this.s === null || this.s === undefined)
|
202 | return new this.constructor('')
|
203 | var s = this.underscore().replace(/_id$/,'').replace(/_/g, ' ').trim().capitalize()
|
204 | return new this.constructor(s)
|
205 | },
|
206 |
|
207 | isAlpha: function() {
|
208 | return !/[^a-z\xDF-\xFF]|^$/.test(this.s.toLowerCase());
|
209 | },
|
210 |
|
211 | isAlphaNumeric: function() {
|
212 | return !/[^0-9a-z\xDF-\xFF]/.test(this.s.toLowerCase());
|
213 | },
|
214 |
|
215 | isEmpty: function() {
|
216 | return this.s === null || this.s === undefined ? true : /^[\s\xa0]*$/.test(this.s);
|
217 | },
|
218 |
|
219 | isLower: function() {
|
220 | return this.isAlpha() && this.s.toLowerCase() === this.s;
|
221 | },
|
222 |
|
223 | isNumeric: function() {
|
224 | return !/[^0-9]/.test(this.s);
|
225 | },
|
226 |
|
227 | isUpper: function() {
|
228 | return this.isAlpha() && this.s.toUpperCase() === this.s;
|
229 | },
|
230 |
|
231 | left: function(N) {
|
232 | if (N >= 0) {
|
233 | var s = this.s.substr(0, N);
|
234 | return new this.constructor(s);
|
235 | } else {
|
236 | return this.right(-N);
|
237 | }
|
238 | },
|
239 |
|
240 | lines: function() { //convert windows newlines to unix newlines then convert to an Array of lines
|
241 | return this.replaceAll('\r\n', '\n').s.split('\n');
|
242 | },
|
243 |
|
244 | pad: function(len, ch) { //https://github.com/component/pad
|
245 | if (ch == null) ch = ' ';
|
246 | if (this.s.length >= len) return new this.constructor(this.s);
|
247 | len = len - this.s.length;
|
248 | var left = Array(Math.ceil(len / 2) + 1).join(ch);
|
249 | var right = Array(Math.floor(len / 2) + 1).join(ch);
|
250 | return new this.constructor(left + this.s + right);
|
251 | },
|
252 |
|
253 | padLeft: function(len, ch) { //https://github.com/component/pad
|
254 | if (ch == null) ch = ' ';
|
255 | if (this.s.length >= len) return new this.constructor(this.s);
|
256 | return new this.constructor(Array(len - this.s.length + 1).join(ch) + this.s);
|
257 | },
|
258 |
|
259 | padRight: function(len, ch) { //https://github.com/component/pad
|
260 | if (ch == null) ch = ' ';
|
261 | if (this.s.length >= len) return new this.constructor(this.s);
|
262 | return new this.constructor(this.s + Array(len - this.s.length + 1).join(ch));
|
263 | },
|
264 |
|
265 | parseCSV: function(delimiter, qualifier, escape, lineDelimiter) { //try to parse no matter what
|
266 | delimiter = delimiter || ',';
|
267 | escape = escape || '\\'
|
268 | if (typeof qualifier == 'undefined')
|
269 | qualifier = '"';
|
270 |
|
271 | var i = 0, fieldBuffer = [], fields = [], len = this.s.length, inField = false, inUnqualifiedString = false, self = this;
|
272 | var ca = function(i){return self.s.charAt(i)};
|
273 | if (typeof lineDelimiter !== 'undefined') var rows = [];
|
274 |
|
275 | if (!qualifier)
|
276 | inField = true;
|
277 |
|
278 | while (i < len) {
|
279 | var current = ca(i);
|
280 | switch (current) {
|
281 | case escape:
|
282 | //fix for issues #32 and #35
|
283 | if (inField && ((escape !== qualifier) || ca(i+1) === qualifier)) {
|
284 | i += 1;
|
285 | fieldBuffer.push(ca(i));
|
286 | break;
|
287 | }
|
288 | if (escape !== qualifier) break;
|
289 | case qualifier:
|
290 | inField = !inField;
|
291 | break;
|
292 | case delimiter:
|
293 | if(inUnqualifiedString) {
|
294 | inField=false;
|
295 | inUnqualifiedString=false;
|
296 | }
|
297 | if (inField && qualifier)
|
298 | fieldBuffer.push(current);
|
299 | else {
|
300 | fields.push(fieldBuffer.join(''))
|
301 | fieldBuffer.length = 0;
|
302 | }
|
303 | break;
|
304 | case lineDelimiter:
|
305 | if(inUnqualifiedString) {
|
306 | inField=false;
|
307 | inUnqualifiedString=false;
|
308 | fields.push(fieldBuffer.join(''))
|
309 | rows.push(fields);
|
310 | fields = [];
|
311 | fieldBuffer.length = 0;
|
312 | }
|
313 | else if (inField) {
|
314 | fieldBuffer.push(current);
|
315 | } else {
|
316 | if (rows) {
|
317 | fields.push(fieldBuffer.join(''))
|
318 | rows.push(fields);
|
319 | fields = [];
|
320 | fieldBuffer.length = 0;
|
321 | }
|
322 | }
|
323 | break;
|
324 | case ' ':
|
325 | if (inField)
|
326 | fieldBuffer.push(current);
|
327 | break;
|
328 | default:
|
329 | if (inField)
|
330 | fieldBuffer.push(current);
|
331 | else if(current!==qualifier) {
|
332 | fieldBuffer.push(current);
|
333 | inField=true;
|
334 | inUnqualifiedString=true;
|
335 | }
|
336 | break;
|
337 | }
|
338 | i += 1;
|
339 | }
|
340 |
|
341 | fields.push(fieldBuffer.join(''));
|
342 | if (rows) {
|
343 | rows.push(fields);
|
344 | return rows;
|
345 | }
|
346 | return fields;
|
347 | },
|
348 |
|
349 | replaceAll: function(ss, r) {
|
350 | //var s = this.s.replace(new RegExp(ss, 'g'), r);
|
351 | var s = this.s.split(ss).join(r)
|
352 | return new this.constructor(s);
|
353 | },
|
354 |
|
355 | splitLeft: function(sep, maxSplit, limit) {
|
356 | return require('./_splitLeft')(this.s, sep, maxSplit, limit)
|
357 | },
|
358 |
|
359 | splitRight: function(sep, maxSplit, limit) {
|
360 | return require('./_splitRight')(this.s, sep, maxSplit, limit)
|
361 | },
|
362 |
|
363 | strip: function() {
|
364 | var ss = this.s;
|
365 | for(var i= 0, n=arguments.length; i<n; i++) {
|
366 | ss = ss.split(arguments[i]).join('');
|
367 | }
|
368 | return new this.constructor(ss);
|
369 | },
|
370 |
|
371 | stripLeft: function (chars) {
|
372 | var regex;
|
373 | var pattern;
|
374 | var ss = ensureString(this.s);
|
375 |
|
376 | if (chars === undefined) {
|
377 | pattern = /^\s+/g;
|
378 | }
|
379 | else {
|
380 | regex = escapeRegExp(chars);
|
381 | pattern = new RegExp("^[" + regex + "]+", "g");
|
382 | }
|
383 |
|
384 | return new this.constructor(ss.replace(pattern, ""));
|
385 | },
|
386 |
|
387 | stripRight: function (chars) {
|
388 | var regex;
|
389 | var pattern;
|
390 | var ss = ensureString(this.s);
|
391 |
|
392 | if (chars === undefined) {
|
393 | pattern = /\s+$/g;
|
394 | }
|
395 | else {
|
396 | regex = escapeRegExp(chars);
|
397 | pattern = new RegExp("[" + regex + "]+$", "g");
|
398 | }
|
399 |
|
400 | return new this.constructor(ss.replace(pattern, ""));
|
401 | },
|
402 |
|
403 | right: function(N) {
|
404 | if (N >= 0) {
|
405 | var s = this.s.substr(this.s.length - N, N);
|
406 | return new this.constructor(s);
|
407 | } else {
|
408 | return this.left(-N);
|
409 | }
|
410 | },
|
411 |
|
412 | setValue: function (s) {
|
413 | initialize(this, s);
|
414 | return this;
|
415 | },
|
416 |
|
417 | slugify: function() {
|
418 | var sl = (new S(new S(this.s).latinise().s.replace(/[^\w\s-]/g, '').toLowerCase())).dasherize().s;
|
419 | if (sl.charAt(0) === '-')
|
420 | sl = sl.substr(1);
|
421 | return new this.constructor(sl);
|
422 | },
|
423 |
|
424 | startsWith: function() {
|
425 | var prefixes = Array.prototype.slice.call(arguments, 0);
|
426 | for (var i = 0; i < prefixes.length; ++i) {
|
427 | if (this.s.lastIndexOf(prefixes[i], 0) === 0) return true;
|
428 | }
|
429 | return false;
|
430 | },
|
431 |
|
432 | stripPunctuation: function() {
|
433 | //return new this.constructor(this.s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,""));
|
434 | return new this.constructor(this.s.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " "));
|
435 | },
|
436 |
|
437 | stripTags: function() { //from sugar.js
|
438 | var s = this.s, args = arguments.length > 0 ? arguments : [''];
|
439 | multiArgs(args, function(tag) {
|
440 | s = s.replace(RegExp('<\/?' + tag + '[^<>]*>', 'gi'), '');
|
441 | });
|
442 | return new this.constructor(s);
|
443 | },
|
444 |
|
445 | template: function(values, opening, closing) {
|
446 | var s = this.s
|
447 | var opening = opening || Export.TMPL_OPEN
|
448 | var closing = closing || Export.TMPL_CLOSE
|
449 |
|
450 | var open = opening.replace(/[-[\]()*\s]/g, "\\$&").replace(/\$/g, '\\$')
|
451 | var close = closing.replace(/[-[\]()*\s]/g, "\\$&").replace(/\$/g, '\\$')
|
452 | var r = new RegExp(open + '(.+?)' + close, 'g')
|
453 | //, r = /\{\{(.+?)\}\}/g
|
454 | var matches = s.match(r) || [];
|
455 |
|
456 | matches.forEach(function(match) {
|
457 | var key = match.substring(opening.length, match.length - closing.length).trim();//chop {{ and }}
|
458 | var value = typeof values[key] == 'undefined' ? '' : values[key];
|
459 | s = s.replace(match, value);
|
460 | });
|
461 | return new this.constructor(s);
|
462 | },
|
463 |
|
464 | times: function(n) {
|
465 | return new this.constructor(new Array(n + 1).join(this.s));
|
466 | },
|
467 |
|
468 | titleCase: function() {
|
469 | var s = this.s;
|
470 | if (s) {
|
471 | s = s.replace(/(^[a-z]| [a-z]|-[a-z]|_[a-z])/g,
|
472 | function($1){
|
473 | return $1.toUpperCase();
|
474 | }
|
475 | );
|
476 | }
|
477 | return new this.constructor(s);
|
478 | },
|
479 |
|
480 | toBoolean: function() {
|
481 | if (typeof this.orig === 'string') {
|
482 | var s = this.s.toLowerCase();
|
483 | return s === 'true' || s === 'yes' || s === 'on' || s === '1';
|
484 | } else
|
485 | return this.orig === true || this.orig === 1;
|
486 | },
|
487 |
|
488 | toFloat: function(precision) {
|
489 | var num = parseFloat(this.s)
|
490 | if (precision)
|
491 | return parseFloat(num.toFixed(precision))
|
492 | else
|
493 | return num
|
494 | },
|
495 |
|
496 | toInt: function() { //thanks Google
|
497 | // If the string starts with '0x' or '-0x', parse as hex.
|
498 | return /^\s*-?0x/i.test(this.s) ? parseInt(this.s, 16) : parseInt(this.s, 10)
|
499 | },
|
500 |
|
501 | trim: function() {
|
502 | var s;
|
503 | if (typeof __nsp.trim === 'undefined')
|
504 | s = this.s.replace(/(^\s*|\s*$)/g, '')
|
505 | else
|
506 | s = this.s.trim()
|
507 | return new this.constructor(s);
|
508 | },
|
509 |
|
510 | trimLeft: function() {
|
511 | var s;
|
512 | if (__nsp.trimLeft)
|
513 | s = this.s.trimLeft();
|
514 | else
|
515 | s = this.s.replace(/(^\s*)/g, '');
|
516 | return new this.constructor(s);
|
517 | },
|
518 |
|
519 | trimRight: function() {
|
520 | var s;
|
521 | if (__nsp.trimRight)
|
522 | s = this.s.trimRight();
|
523 | else
|
524 | s = this.s.replace(/\s+$/, '');
|
525 | return new this.constructor(s);
|
526 | },
|
527 |
|
528 | truncate: function(length, pruneStr) { //from underscore.string, author: github.com/rwz
|
529 | var str = this.s;
|
530 |
|
531 | length = ~~length;
|
532 | pruneStr = pruneStr || '...';
|
533 |
|
534 | if (str.length <= length) return new this.constructor(str);
|
535 |
|
536 | var tmpl = function(c){ return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; },
|
537 | template = str.slice(0, length+1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA'
|
538 |
|
539 | if (template.slice(template.length-2).match(/\w\w/))
|
540 | template = template.replace(/\s*\S+$/, '');
|
541 | else
|
542 | template = new S(template.slice(0, template.length-1)).trimRight().s;
|
543 |
|
544 | return (template+pruneStr).length > str.length ? new S(str) : new S(str.slice(0, template.length)+pruneStr);
|
545 | },
|
546 |
|
547 | toCSV: function() {
|
548 | var delim = ',', qualifier = '"', escape = '\\', encloseNumbers = true, keys = false;
|
549 | var dataArray = [];
|
550 |
|
551 | function hasVal(it) {
|
552 | return it !== null && it !== '';
|
553 | }
|
554 |
|
555 | if (typeof arguments[0] === 'object') {
|
556 | delim = arguments[0].delimiter || delim;
|
557 | delim = arguments[0].separator || delim;
|
558 | qualifier = arguments[0].qualifier || qualifier;
|
559 | encloseNumbers = !!arguments[0].encloseNumbers;
|
560 | escape = arguments[0].escape || escape;
|
561 | keys = !!arguments[0].keys;
|
562 | } else if (typeof arguments[0] === 'string') {
|
563 | delim = arguments[0];
|
564 | }
|
565 |
|
566 | if (typeof arguments[1] === 'string')
|
567 | qualifier = arguments[1];
|
568 |
|
569 | if (arguments[1] === null)
|
570 | qualifier = null;
|
571 |
|
572 | if (this.orig instanceof Array)
|
573 | dataArray = this.orig;
|
574 | else { //object
|
575 | for (var key in this.orig)
|
576 | if (this.orig.hasOwnProperty(key))
|
577 | if (keys)
|
578 | dataArray.push(key);
|
579 | else
|
580 | dataArray.push(this.orig[key]);
|
581 | }
|
582 |
|
583 | var rep = escape + qualifier;
|
584 | var buildString = [];
|
585 | for (var i = 0; i < dataArray.length; ++i) {
|
586 | var shouldQualify = hasVal(qualifier)
|
587 | if (typeof dataArray[i] == 'number')
|
588 | shouldQualify &= encloseNumbers;
|
589 |
|
590 | if (shouldQualify)
|
591 | buildString.push(qualifier);
|
592 |
|
593 | if (dataArray[i] !== null && dataArray[i] !== undefined) {
|
594 | var d = new S(dataArray[i]).replaceAll(qualifier, rep).s;
|
595 | buildString.push(d);
|
596 | } else
|
597 | buildString.push('')
|
598 |
|
599 | if (shouldQualify)
|
600 | buildString.push(qualifier);
|
601 |
|
602 | if (delim)
|
603 | buildString.push(delim);
|
604 | }
|
605 |
|
606 | //chop last delim
|
607 | //console.log(buildString.length)
|
608 | buildString.length = buildString.length - 1;
|
609 | return new this.constructor(buildString.join(''));
|
610 | },
|
611 |
|
612 | toString: function() {
|
613 | return this.s;
|
614 | },
|
615 |
|
616 | //#modified from https://github.com/epeli/underscore.string
|
617 | underscore: function() {
|
618 | var s = this.trim().s.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/([A-Z\d]+)([A-Z][a-z])/g,'$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
|
619 | return new this.constructor(s);
|
620 | },
|
621 |
|
622 | unescapeHTML: function() { //from underscore.string
|
623 | return new this.constructor(this.s.replace(/\&([^;]+);/g, function(entity, entityCode){
|
624 | var match;
|
625 |
|
626 | if (entityCode in escapeChars) {
|
627 | return escapeChars[entityCode];
|
628 | } else if (match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
|
629 | return String.fromCharCode(parseInt(match[1], 16));
|
630 | } else if (match = entityCode.match(/^#(\d+)$/)) {
|
631 | return String.fromCharCode(~~match[1]);
|
632 | } else {
|
633 | return entity;
|
634 | }
|
635 | }));
|
636 | },
|
637 |
|
638 | valueOf: function() {
|
639 | return this.s.valueOf();
|
640 | },
|
641 |
|
642 | //#Added a New Function called wrapHTML.
|
643 | wrapHTML: function (tagName, tagAttrs) {
|
644 | var s = this.s, el = (tagName == null) ? 'span' : tagName, elAttr = '', wrapped = '';
|
645 | if(typeof tagAttrs == 'object') for(var prop in tagAttrs) elAttr += ' ' + prop + '="' +(new this.constructor(tagAttrs[prop])).escapeHTML() + '"';
|
646 | s = wrapped.concat('<', el, elAttr, '>', this, '</', el, '>');
|
647 | return new this.constructor(s);
|
648 | }
|
649 | }
|
650 |
|
651 | var methodsAdded = [];
|
652 | function extendPrototype() {
|
653 | for (var name in __sp) {
|
654 | (function(name){
|
655 | var func = __sp[name];
|
656 | if (!__nsp.hasOwnProperty(name)) {
|
657 | methodsAdded.push(name);
|
658 | __nsp[name] = function() {
|
659 | String.prototype.s = this;
|
660 | return func.apply(this, arguments);
|
661 | }
|
662 | }
|
663 | })(name);
|
664 | }
|
665 | }
|
666 |
|
667 | function restorePrototype() {
|
668 | for (var i = 0; i < methodsAdded.length; ++i)
|
669 | delete String.prototype[methodsAdded[i]];
|
670 | methodsAdded.length = 0;
|
671 | }
|
672 |
|
673 |
|
674 | /*************************************
|
675 | /* Attach Native JavaScript String Properties
|
676 | /*************************************/
|
677 |
|
678 | var nativeProperties = getNativeStringProperties();
|
679 | for (var name in nativeProperties) {
|
680 | (function(name) {
|
681 | var stringProp = __nsp[name];
|
682 | if (typeof stringProp == 'function') {
|
683 | //console.log(stringProp)
|
684 | if (!__sp[name]) {
|
685 | if (nativeProperties[name] === 'string') {
|
686 | __sp[name] = function() {
|
687 | //console.log(name)
|
688 | return new this.constructor(stringProp.apply(this, arguments));
|
689 | }
|
690 | } else {
|
691 | __sp[name] = stringProp;
|
692 | }
|
693 | }
|
694 | }
|
695 | })(name);
|
696 | }
|
697 |
|
698 |
|
699 | /*************************************
|
700 | /* Function Aliases
|
701 | /*************************************/
|
702 |
|
703 | __sp.repeat = __sp.times;
|
704 | __sp.include = __sp.contains;
|
705 | __sp.toInteger = __sp.toInt;
|
706 | __sp.toBool = __sp.toBoolean;
|
707 | __sp.decodeHTMLEntities = __sp.decodeHtmlEntities //ensure consistent casing scheme of 'HTML'
|
708 |
|
709 |
|
710 | //******************************************************************************
|
711 | // Set the constructor. Without this, string.js objects are instances of
|
712 | // Object instead of S.
|
713 | //******************************************************************************
|
714 |
|
715 | __sp.constructor = S;
|
716 |
|
717 |
|
718 | /*************************************
|
719 | /* Private Functions
|
720 | /*************************************/
|
721 |
|
722 | function getNativeStringProperties() {
|
723 | var names = getNativeStringPropertyNames();
|
724 | var retObj = {};
|
725 |
|
726 | for (var i = 0; i < names.length; ++i) {
|
727 | var name = names[i];
|
728 | if (name === 'to' || name === 'toEnd') continue; // get rid of the shelljs prototype messup
|
729 | var func = __nsp[name];
|
730 | try {
|
731 | var type = typeof func.apply('teststring');
|
732 | retObj[name] = type;
|
733 | } catch (e) {}
|
734 | }
|
735 | return retObj;
|
736 | }
|
737 |
|
738 | function getNativeStringPropertyNames() {
|
739 | var results = [];
|
740 | if (Object.getOwnPropertyNames) {
|
741 | results = Object.getOwnPropertyNames(__nsp);
|
742 | results.splice(results.indexOf('valueOf'), 1);
|
743 | results.splice(results.indexOf('toString'), 1);
|
744 | return results;
|
745 | } else { //meant for legacy cruft, this could probably be made more efficient
|
746 | var stringNames = {};
|
747 | var objectNames = [];
|
748 | for (var name in String.prototype)
|
749 | stringNames[name] = name;
|
750 |
|
751 | for (var name in Object.prototype)
|
752 | delete stringNames[name];
|
753 |
|
754 | //stringNames['toString'] = 'toString'; //this was deleted with the rest of the object names
|
755 | for (var name in stringNames) {
|
756 | results.push(name);
|
757 | }
|
758 | return results;
|
759 | }
|
760 | }
|
761 |
|
762 | function Export(str) {
|
763 | return new S(str);
|
764 | };
|
765 |
|
766 | //attach exports to StringJSWrapper
|
767 | Export.extendPrototype = extendPrototype;
|
768 | Export.restorePrototype = restorePrototype;
|
769 | Export.VERSION = VERSION;
|
770 | Export.TMPL_OPEN = '{{';
|
771 | Export.TMPL_CLOSE = '}}';
|
772 | Export.ENTITIES = ENTITIES;
|
773 |
|
774 |
|
775 |
|
776 | /*************************************
|
777 | /* Exports
|
778 | /*************************************/
|
779 |
|
780 | if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
781 | module.exports = Export;
|
782 |
|
783 | } else {
|
784 |
|
785 | if(typeof define === "function" && define.amd) {
|
786 | define([], function() {
|
787 | return Export;
|
788 | });
|
789 | } else {
|
790 | window.S = Export;
|
791 | }
|
792 | }
|
793 |
|
794 |
|
795 | /*************************************
|
796 | /* 3rd Party Private Functions
|
797 | /*************************************/
|
798 |
|
799 | //from sugar.js
|
800 | function multiArgs(args, fn) {
|
801 | var result = [], i;
|
802 | for(i = 0; i < args.length; i++) {
|
803 | result.push(args[i]);
|
804 | if(fn) fn.call(args, args[i], i);
|
805 | }
|
806 | return result;
|
807 | }
|
808 |
|
809 | //from underscore.string
|
810 | var escapeChars = {
|
811 | lt: '<',
|
812 | gt: '>',
|
813 | quot: '"',
|
814 | apos: "'",
|
815 | amp: '&'
|
816 | };
|
817 |
|
818 | function escapeRegExp (s) {
|
819 | // most part from https://github.com/skulpt/skulpt/blob/ecaf75e69c2e539eff124b2ab45df0b01eaf2295/src/str.js#L242
|
820 | var c;
|
821 | var i;
|
822 | var ret = [];
|
823 | var re = /^[A-Za-z0-9]+$/;
|
824 | s = ensureString(s);
|
825 | for (i = 0; i < s.length; ++i) {
|
826 | c = s.charAt(i);
|
827 |
|
828 | if (re.test(c)) {
|
829 | ret.push(c);
|
830 | }
|
831 | else {
|
832 | if (c === "\\000") {
|
833 | ret.push("\\000");
|
834 | }
|
835 | else {
|
836 | ret.push("\\" + c);
|
837 | }
|
838 | }
|
839 | }
|
840 | return ret.join("");
|
841 | }
|
842 |
|
843 | function ensureString(string) {
|
844 | return string == null ? '' : '' + string;
|
845 | }
|
846 |
|
847 | //from underscore.string
|
848 | var reversedEscapeChars = {};
|
849 | for(var key in escapeChars){ reversedEscapeChars[escapeChars[key]] = key; }
|
850 |
|
851 | ENTITIES = {
|
852 | "amp" : "&",
|
853 | "gt" : ">",
|
854 | "lt" : "<",
|
855 | "quot" : "\"",
|
856 | "apos" : "'",
|
857 | "AElig" : 198,
|
858 | "Aacute" : 193,
|
859 | "Acirc" : 194,
|
860 | "Agrave" : 192,
|
861 | "Aring" : 197,
|
862 | "Atilde" : 195,
|
863 | "Auml" : 196,
|
864 | "Ccedil" : 199,
|
865 | "ETH" : 208,
|
866 | "Eacute" : 201,
|
867 | "Ecirc" : 202,
|
868 | "Egrave" : 200,
|
869 | "Euml" : 203,
|
870 | "Iacute" : 205,
|
871 | "Icirc" : 206,
|
872 | "Igrave" : 204,
|
873 | "Iuml" : 207,
|
874 | "Ntilde" : 209,
|
875 | "Oacute" : 211,
|
876 | "Ocirc" : 212,
|
877 | "Ograve" : 210,
|
878 | "Oslash" : 216,
|
879 | "Otilde" : 213,
|
880 | "Ouml" : 214,
|
881 | "THORN" : 222,
|
882 | "Uacute" : 218,
|
883 | "Ucirc" : 219,
|
884 | "Ugrave" : 217,
|
885 | "Uuml" : 220,
|
886 | "Yacute" : 221,
|
887 | "aacute" : 225,
|
888 | "acirc" : 226,
|
889 | "aelig" : 230,
|
890 | "agrave" : 224,
|
891 | "aring" : 229,
|
892 | "atilde" : 227,
|
893 | "auml" : 228,
|
894 | "ccedil" : 231,
|
895 | "eacute" : 233,
|
896 | "ecirc" : 234,
|
897 | "egrave" : 232,
|
898 | "eth" : 240,
|
899 | "euml" : 235,
|
900 | "iacute" : 237,
|
901 | "icirc" : 238,
|
902 | "igrave" : 236,
|
903 | "iuml" : 239,
|
904 | "ntilde" : 241,
|
905 | "oacute" : 243,
|
906 | "ocirc" : 244,
|
907 | "ograve" : 242,
|
908 | "oslash" : 248,
|
909 | "otilde" : 245,
|
910 | "ouml" : 246,
|
911 | "szlig" : 223,
|
912 | "thorn" : 254,
|
913 | "uacute" : 250,
|
914 | "ucirc" : 251,
|
915 | "ugrave" : 249,
|
916 | "uuml" : 252,
|
917 | "yacute" : 253,
|
918 | "yuml" : 255,
|
919 | "copy" : 169,
|
920 | "reg" : 174,
|
921 | "nbsp" : 160,
|
922 | "iexcl" : 161,
|
923 | "cent" : 162,
|
924 | "pound" : 163,
|
925 | "curren" : 164,
|
926 | "yen" : 165,
|
927 | "brvbar" : 166,
|
928 | "sect" : 167,
|
929 | "uml" : 168,
|
930 | "ordf" : 170,
|
931 | "laquo" : 171,
|
932 | "not" : 172,
|
933 | "shy" : 173,
|
934 | "macr" : 175,
|
935 | "deg" : 176,
|
936 | "plusmn" : 177,
|
937 | "sup1" : 185,
|
938 | "sup2" : 178,
|
939 | "sup3" : 179,
|
940 | "acute" : 180,
|
941 | "micro" : 181,
|
942 | "para" : 182,
|
943 | "middot" : 183,
|
944 | "cedil" : 184,
|
945 | "ordm" : 186,
|
946 | "raquo" : 187,
|
947 | "frac14" : 188,
|
948 | "frac12" : 189,
|
949 | "frac34" : 190,
|
950 | "iquest" : 191,
|
951 | "times" : 215,
|
952 | "divide" : 247,
|
953 | "OElig;" : 338,
|
954 | "oelig;" : 339,
|
955 | "Scaron;" : 352,
|
956 | "scaron;" : 353,
|
957 | "Yuml;" : 376,
|
958 | "fnof;" : 402,
|
959 | "circ;" : 710,
|
960 | "tilde;" : 732,
|
961 | "Alpha;" : 913,
|
962 | "Beta;" : 914,
|
963 | "Gamma;" : 915,
|
964 | "Delta;" : 916,
|
965 | "Epsilon;" : 917,
|
966 | "Zeta;" : 918,
|
967 | "Eta;" : 919,
|
968 | "Theta;" : 920,
|
969 | "Iota;" : 921,
|
970 | "Kappa;" : 922,
|
971 | "Lambda;" : 923,
|
972 | "Mu;" : 924,
|
973 | "Nu;" : 925,
|
974 | "Xi;" : 926,
|
975 | "Omicron;" : 927,
|
976 | "Pi;" : 928,
|
977 | "Rho;" : 929,
|
978 | "Sigma;" : 931,
|
979 | "Tau;" : 932,
|
980 | "Upsilon;" : 933,
|
981 | "Phi;" : 934,
|
982 | "Chi;" : 935,
|
983 | "Psi;" : 936,
|
984 | "Omega;" : 937,
|
985 | "alpha;" : 945,
|
986 | "beta;" : 946,
|
987 | "gamma;" : 947,
|
988 | "delta;" : 948,
|
989 | "epsilon;" : 949,
|
990 | "zeta;" : 950,
|
991 | "eta;" : 951,
|
992 | "theta;" : 952,
|
993 | "iota;" : 953,
|
994 | "kappa;" : 954,
|
995 | "lambda;" : 955,
|
996 | "mu;" : 956,
|
997 | "nu;" : 957,
|
998 | "xi;" : 958,
|
999 | "omicron;" : 959,
|
1000 | "pi;" : 960,
|
1001 | "rho;" : 961,
|
1002 | "sigmaf;" : 962,
|
1003 | "sigma;" : 963,
|
1004 | "tau;" : 964,
|
1005 | "upsilon;" : 965,
|
1006 | "phi;" : 966,
|
1007 | "chi;" : 967,
|
1008 | "psi;" : 968,
|
1009 | "omega;" : 969,
|
1010 | "thetasym;" : 977,
|
1011 | "upsih;" : 978,
|
1012 | "piv;" : 982,
|
1013 | "ensp;" : 8194,
|
1014 | "emsp;" : 8195,
|
1015 | "thinsp;" : 8201,
|
1016 | "zwnj;" : 8204,
|
1017 | "zwj;" : 8205,
|
1018 | "lrm;" : 8206,
|
1019 | "rlm;" : 8207,
|
1020 | "ndash;" : 8211,
|
1021 | "mdash;" : 8212,
|
1022 | "lsquo;" : 8216,
|
1023 | "rsquo;" : 8217,
|
1024 | "sbquo;" : 8218,
|
1025 | "ldquo;" : 8220,
|
1026 | "rdquo;" : 8221,
|
1027 | "bdquo;" : 8222,
|
1028 | "dagger;" : 8224,
|
1029 | "Dagger;" : 8225,
|
1030 | "bull;" : 8226,
|
1031 | "hellip;" : 8230,
|
1032 | "permil;" : 8240,
|
1033 | "prime;" : 8242,
|
1034 | "Prime;" : 8243,
|
1035 | "lsaquo;" : 8249,
|
1036 | "rsaquo;" : 8250,
|
1037 | "oline;" : 8254,
|
1038 | "frasl;" : 8260,
|
1039 | "euro;" : 8364,
|
1040 | "image;" : 8465,
|
1041 | "weierp;" : 8472,
|
1042 | "real;" : 8476,
|
1043 | "trade;" : 8482,
|
1044 | "alefsym;" : 8501,
|
1045 | "larr;" : 8592,
|
1046 | "uarr;" : 8593,
|
1047 | "rarr;" : 8594,
|
1048 | "darr;" : 8595,
|
1049 | "harr;" : 8596,
|
1050 | "crarr;" : 8629,
|
1051 | "lArr;" : 8656,
|
1052 | "uArr;" : 8657,
|
1053 | "rArr;" : 8658,
|
1054 | "dArr;" : 8659,
|
1055 | "hArr;" : 8660,
|
1056 | "forall;" : 8704,
|
1057 | "part;" : 8706,
|
1058 | "exist;" : 8707,
|
1059 | "empty;" : 8709,
|
1060 | "nabla;" : 8711,
|
1061 | "isin;" : 8712,
|
1062 | "notin;" : 8713,
|
1063 | "ni;" : 8715,
|
1064 | "prod;" : 8719,
|
1065 | "sum;" : 8721,
|
1066 | "minus;" : 8722,
|
1067 | "lowast;" : 8727,
|
1068 | "radic;" : 8730,
|
1069 | "prop;" : 8733,
|
1070 | "infin;" : 8734,
|
1071 | "ang;" : 8736,
|
1072 | "and;" : 8743,
|
1073 | "or;" : 8744,
|
1074 | "cap;" : 8745,
|
1075 | "cup;" : 8746,
|
1076 | "int;" : 8747,
|
1077 | "there4;" : 8756,
|
1078 | "sim;" : 8764,
|
1079 | "cong;" : 8773,
|
1080 | "asymp;" : 8776,
|
1081 | "ne;" : 8800,
|
1082 | "equiv;" : 8801,
|
1083 | "le;" : 8804,
|
1084 | "ge;" : 8805,
|
1085 | "sub;" : 8834,
|
1086 | "sup;" : 8835,
|
1087 | "nsub;" : 8836,
|
1088 | "sube;" : 8838,
|
1089 | "supe;" : 8839,
|
1090 | "oplus;" : 8853,
|
1091 | "otimes;" : 8855,
|
1092 | "perp;" : 8869,
|
1093 | "sdot;" : 8901,
|
1094 | "lceil;" : 8968,
|
1095 | "rceil;" : 8969,
|
1096 | "lfloor;" : 8970,
|
1097 | "rfloor;" : 8971,
|
1098 | "lang;" : 9001,
|
1099 | "rang;" : 9002,
|
1100 | "loz;" : 9674,
|
1101 | "spades;" : 9824,
|
1102 | "clubs;" : 9827,
|
1103 | "hearts;" : 9829,
|
1104 | "diams;" : 9830
|
1105 | }
|
1106 |
|
1107 |
|
1108 | }).call(this);
|