Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / output / Ext.util.Inflector.js
1 Ext.data.JsonP.Ext_util_Inflector({
2   "tagname": "class",
3   "name": "Ext.util.Inflector",
4   "doc": "<p>General purpose inflector class that <a href=\"#/api/Ext.util.Inflector-method-pluralize\" rel=\"Ext.util.Inflector-method-pluralize\" class=\"docClass\">pluralizes</a>, <a href=\"#/api/Ext.util.Inflector-method-singularize\" rel=\"Ext.util.Inflector-method-singularize\" class=\"docClass\">singularizes</a> and \n<a href=\"#/api/Ext.util.Inflector-method-ordinalize\" rel=\"Ext.util.Inflector-method-ordinalize\" class=\"docClass\">ordinalizes</a> words. Sample usage:</p>\n\n\n\n\n<pre><code>//turning singular words into plurals\nExt.util.Inflector.pluralize('word'); //'words'\nExt.util.Inflector.pluralize('person'); //'people'\nExt.util.Inflector.pluralize('sheep'); //'sheep'\n\n//turning plurals into singulars\nExt.util.Inflector.singularize('words'); //'word'\nExt.util.Inflector.singularize('people'); //'person'\nExt.util.Inflector.singularize('sheep'); //'sheep'\n\n//ordinalizing numbers\nExt.util.Inflector.ordinalize(11); //\"11th\"\nExt.util.Inflector.ordinalize(21); //\"21th\"\nExt.util.Inflector.ordinalize(1043); //\"1043rd\"\n</code></pre>\n\n\n\n\n<p><u>Customization</u></p>\n\n\n\n\n<p>The Inflector comes with a default set of US English pluralization rules. These can be augmented with additional\nrules if the default rules do not meet your application's requirements, or swapped out entirely for other languages.\nHere is how we might add a rule that pluralizes \"ox\" to \"oxen\":</p>\n\n\n\n\n<pre><code>Ext.util.Inflector.plural(/^(ox)$/i, \"$1en\");\n</code></pre>\n\n\n\n\n<p>Each rule consists of two items - a regular expression that matches one or more rules, and a replacement string.\nIn this case, the regular expression will only match the string \"ox\", and will replace that match with \"oxen\". \nHere's how we could add the inverse rule:</p>\n\n\n\n\n<pre><code>Ext.util.Inflector.singular(/^(ox)en$/i, \"$1\");\n</code></pre>\n\n\n\n\n<p>Note that the ox/oxen rules are present by default.</p>\n\n",
5   "extends": "Object",
6   "mixins": [
7
8   ],
9   "alternateClassNames": [
10
11   ],
12   "xtype": null,
13   "author": null,
14   "docauthor": null,
15   "singleton": true,
16   "private": false,
17   "cfg": [
18
19   ],
20   "method": [
21     {
22       "tagname": "method",
23       "name": "classify",
24       "member": "Ext.util.Inflector",
25       "doc": "<p>Returns the correct <a href=\"#/api/Ext.data.Model\" rel=\"Ext.data.Model\" class=\"docClass\">Model</a> name for a given string. Mostly used internally by the data\npackage</p>\n",
26       "params": [
27         {
28           "type": "String",
29           "name": "word",
30           "doc": "<p>The word to classify</p>\n",
31           "optional": false
32         }
33       ],
34       "return": {
35         "type": "String",
36         "doc": "<p>The classified version of the word</p>\n"
37       },
38       "private": false,
39       "static": false,
40       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
41       "linenr": 237,
42       "html_filename": "Inflector.html",
43       "href": "Inflector.html#Ext-util-Inflector-method-classify",
44       "shortDoc": "<p>Returns the correct <a href=\"#/api/Ext.data.Model\" rel=\"Ext.data.Model\" class=\"docClass\">Model</a> name for a given string. Mostly used internally by the data\npackage</p>\n"
45     },
46     {
47       "tagname": "method",
48       "name": "clearPlurals",
49       "member": "Ext.util.Inflector",
50       "doc": "<p>Removes all registered pluralization rules</p>\n",
51       "params": [
52
53       ],
54       "return": {
55         "type": "void",
56         "doc": "\n"
57       },
58       "private": false,
59       "static": false,
60       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
61       "linenr": 169,
62       "html_filename": "Inflector.html",
63       "href": "Inflector.html#Ext-util-Inflector-method-clearPlurals",
64       "shortDoc": "<p>Removes all registered pluralization rules</p>\n"
65     },
66     {
67       "tagname": "method",
68       "name": "clearSingulars",
69       "member": "Ext.util.Inflector",
70       "doc": "<p>Removes all registered singularization rules</p>\n",
71       "params": [
72
73       ],
74       "return": {
75         "type": "void",
76         "doc": "\n"
77       },
78       "private": false,
79       "static": false,
80       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
81       "linenr": 162,
82       "html_filename": "Inflector.html",
83       "href": "Inflector.html#Ext-util-Inflector-method-clearSingulars",
84       "shortDoc": "<p>Removes all registered singularization rules</p>\n"
85     },
86     {
87       "tagname": "method",
88       "name": "isTransnumeral",
89       "member": "Ext.util.Inflector",
90       "doc": "<p>Returns true if the given word is transnumeral (the word is its own singular and plural form - e.g. sheep, fish)</p>\n",
91       "params": [
92         {
93           "type": "String",
94           "name": "word",
95           "doc": "<p>The word to test</p>\n",
96           "optional": false
97         }
98       ],
99       "return": {
100         "type": "Boolean",
101         "doc": "<p>True if the word is transnumeral</p>\n"
102       },
103       "private": false,
104       "static": false,
105       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
106       "linenr": 176,
107       "html_filename": "Inflector.html",
108       "href": "Inflector.html#Ext-util-Inflector-method-isTransnumeral",
109       "shortDoc": "<p>Returns true if the given word is transnumeral (the word is its own singular and plural form - e.g. sheep, fish)</p>\n"
110     },
111     {
112       "tagname": "method",
113       "name": "ordinalize",
114       "member": "Ext.util.Inflector",
115       "doc": "<p>Ordinalizes a given number by adding a prefix such as 'st', 'nd', 'rd' or 'th' based on the last digit of the\nnumber. 21 -> 21st, 22 -> 22nd, 23 -> 23rd, 24 -> 24th etc</p>\n",
116       "params": [
117         {
118           "type": "Number",
119           "name": "number",
120           "doc": "<p>The number to ordinalize</p>\n",
121           "optional": false
122         }
123       ],
124       "return": {
125         "type": "String",
126         "doc": "<p>The ordinalized number</p>\n"
127       },
128       "private": false,
129       "static": false,
130       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
131       "linenr": 247,
132       "html_filename": "Inflector.html",
133       "href": "Inflector.html#Ext-util-Inflector-method-ordinalize",
134       "shortDoc": "Ordinalizes a given number by adding a prefix such as 'st', 'nd', 'rd' or 'th' based on the last digit of the\nnumber...."
135     },
136     {
137       "tagname": "method",
138       "name": "plural",
139       "member": "Ext.util.Inflector",
140       "doc": "<p>Adds a new pluralization rule to the Inflector. See the intro docs for more information</p>\n",
141       "params": [
142         {
143           "type": "RegExp",
144           "name": "matcher",
145           "doc": "<p>The matcher regex</p>\n",
146           "optional": false
147         },
148         {
149           "type": "String",
150           "name": "replacer",
151           "doc": "<p>The replacement string, which can reference matches from the matcher argument</p>\n",
152           "optional": false
153         }
154       ],
155       "return": {
156         "type": "void",
157         "doc": "\n"
158       },
159       "private": false,
160       "static": false,
161       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
162       "linenr": 153,
163       "html_filename": "Inflector.html",
164       "href": "Inflector.html#Ext-util-Inflector-method-plural",
165       "shortDoc": "<p>Adds a new pluralization rule to the Inflector. See the intro docs for more information</p>\n"
166     },
167     {
168       "tagname": "method",
169       "name": "pluralize",
170       "member": "Ext.util.Inflector",
171       "doc": "<p>Returns the pluralized form of a word (e.g. Ext.util.Inflector.pluralize('word') returns 'words')</p>\n",
172       "params": [
173         {
174           "type": "String",
175           "name": "word",
176           "doc": "<p>The word to pluralize</p>\n",
177           "optional": false
178         }
179       ],
180       "return": {
181         "type": "String",
182         "doc": "<p>The pluralized form of the word</p>\n"
183       },
184       "private": false,
185       "static": false,
186       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
187       "linenr": 185,
188       "html_filename": "Inflector.html",
189       "href": "Inflector.html#Ext-util-Inflector-method-pluralize",
190       "shortDoc": "<p>Returns the pluralized form of a word (e.g. Ext.util.Inflector.pluralize('word') returns 'words')</p>\n"
191     },
192     {
193       "tagname": "method",
194       "name": "singular",
195       "member": "Ext.util.Inflector",
196       "doc": "<p>Adds a new singularization rule to the Inflector. See the intro docs for more information</p>\n",
197       "params": [
198         {
199           "type": "RegExp",
200           "name": "matcher",
201           "doc": "<p>The matcher regex</p>\n",
202           "optional": false
203         },
204         {
205           "type": "String",
206           "name": "replacer",
207           "doc": "<p>The replacement string, which can reference matches from the matcher argument</p>\n",
208           "optional": false
209         }
210       ],
211       "return": {
212         "type": "void",
213         "doc": "\n"
214       },
215       "private": false,
216       "static": false,
217       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
218       "linenr": 144,
219       "html_filename": "Inflector.html",
220       "href": "Inflector.html#Ext-util-Inflector-method-singular",
221       "shortDoc": "<p>Adds a new singularization rule to the Inflector. See the intro docs for more information</p>\n"
222     },
223     {
224       "tagname": "method",
225       "name": "singularize",
226       "member": "Ext.util.Inflector",
227       "doc": "<p>Returns the singularized form of a word (e.g. Ext.util.Inflector.singularize('words') returns 'word')</p>\n",
228       "params": [
229         {
230           "type": "String",
231           "name": "word",
232           "doc": "<p>The word to singularize</p>\n",
233           "optional": false
234         }
235       ],
236       "return": {
237         "type": "String",
238         "doc": "<p>The singularized form of the word</p>\n"
239       },
240       "private": false,
241       "static": false,
242       "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
243       "linenr": 211,
244       "html_filename": "Inflector.html",
245       "href": "Inflector.html#Ext-util-Inflector-method-singularize",
246       "shortDoc": "<p>Returns the singularized form of a word (e.g. Ext.util.Inflector.singularize('words') returns 'word')</p>\n"
247     }
248   ],
249   "property": [
250
251   ],
252   "event": [
253
254   ],
255   "filename": "/Users/nick/Projects/sencha/SDK/platform/src/util/Inflector.js",
256   "linenr": 1,
257   "html_filename": "Inflector.html",
258   "href": "Inflector.html#Ext-util-Inflector",
259   "cssVar": [
260
261   ],
262   "cssMixin": [
263
264   ],
265   "component": false,
266   "superclasses": [
267
268   ],
269   "subclasses": [
270
271   ],
272   "mixedInto": [
273
274   ],
275   "allMixins": [
276
277   ]
278 });