051efd3667438f1173520e5b9ec87ee368788d14
[roojs1] / docs / symbols / String.json
1 {
2   "name" : "String",
3   "augments" : [
4   ],
5   "desc" : "",
6   "isSingleton" : false,
7   "isStatic" : false,
8   "isBuiltin" : true,
9   "memberOf" : "String",
10   "example" : "",
11   "deprecated" : "",
12   "since" : "",
13   "see" : "",
14   "params" : [
15   ],
16   "returns" : [
17   ],
18   "config" : [
19   ],
20   "methods" : [
21     {
22       "name" : "escape",
23       "desc" : "Escapes the passed string for ' and \\",
24       "isStatic" : true,
25       "isConstructor" : false,
26       "isPrivate" : false,
27       "memberOf" : "String",
28       "example" : "",
29       "deprecated" : "",
30       "since" : "",
31       "see" : "",
32       "params" : [
33         {
34           "name" : "string",
35           "type" : "String",
36           "desc" : "The string to escape",
37           "isOptional" : false
38         }
39       ],
40       "returns" : [
41         {
42           "name" : "",
43           "type" : "String",
44           "desc" : "The escaped string"
45         }
46       ]
47     },
48     {
49       "name" : "leftPad",
50       "desc" : "Pads the left side of a string with a specified character.  This is especially useful\nfor normalizing number and date strings.  Example usage:\n<pre><code>\nvar s = String.leftPad('123', 5, '0');\n// s now contains the string: '00123'\n</code></pre>",
51       "isStatic" : true,
52       "isConstructor" : false,
53       "isPrivate" : false,
54       "memberOf" : "String",
55       "example" : "",
56       "deprecated" : "",
57       "since" : "",
58       "see" : "",
59       "params" : [
60         {
61           "name" : "string",
62           "type" : "String",
63           "desc" : "The original string",
64           "isOptional" : false
65         },
66         {
67           "name" : "size",
68           "type" : "Number",
69           "desc" : "The total length of the output string",
70           "isOptional" : false
71         },
72         {
73           "name" : "char",
74           "type" : "String",
75           "desc" : "(optional) The character with which to pad the original string (defaults to empty string \" \")",
76           "isOptional" : false
77         }
78       ],
79       "returns" : [
80         {
81           "name" : "",
82           "type" : "String",
83           "desc" : "The padded string"
84         }
85       ]
86     },
87     {
88       "name" : "toggle",
89       "desc" : "Utility function that allows you to easily switch a string between two alternating values.  The passed value\nis compared to the current string, and if they are equal, the other value that was passed in is returned.  If\nthey are already different, the first value passed in is returned.  Note that this method returns the new value\nbut does not change the current string.\n<pre><code>\n// alternate sort directions\nsort = sort.toggle('ASC', 'DESC');\n\n// instead of conditional logic:\nsort = (sort == 'ASC' ? 'DESC' : 'ASC');\n</code></pre>",
90       "isStatic" : false,
91       "isConstructor" : false,
92       "isPrivate" : false,
93       "memberOf" : "String",
94       "example" : "",
95       "deprecated" : "",
96       "since" : "",
97       "see" : "",
98       "params" : [
99         {
100           "name" : "value",
101           "type" : "String",
102           "desc" : "The value to compare to the current string",
103           "isOptional" : false
104         },
105         {
106           "name" : "other",
107           "type" : "String",
108           "desc" : "The new value to use if the string already equals the first value passed in",
109           "isOptional" : false
110         }
111       ],
112       "returns" : [
113         {
114           "name" : "",
115           "type" : "String",
116           "desc" : "The new value"
117         }
118       ]
119     },
120     {
121       "name" : "format",
122       "desc" : "Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens.  Each\ntoken must be unique, and must increment in the format {0}, {1}, etc.  Example usage:\n<pre><code>\nvar cls = 'my-class', text = 'Some text';\nvar s = String.format('<div class=\"{0}\">{1}</div>', cls, text);\n// s now contains the string: '<div class=\"my-class\">Some text</div>'\n</code></pre>",
123       "isStatic" : true,
124       "isConstructor" : false,
125       "isPrivate" : false,
126       "memberOf" : "String",
127       "example" : "",
128       "deprecated" : "",
129       "since" : "",
130       "see" : "",
131       "params" : [
132         {
133           "name" : "string",
134           "type" : "String",
135           "desc" : "The tokenized string to be formatted",
136           "isOptional" : false
137         },
138         {
139           "name" : "value1",
140           "type" : "String",
141           "desc" : "The value to replace token {0}",
142           "isOptional" : false
143         },
144         {
145           "name" : "value2",
146           "type" : "String",
147           "desc" : "Etc...",
148           "isOptional" : false
149         }
150       ],
151       "returns" : [
152         {
153           "name" : "",
154           "type" : "String",
155           "desc" : "The formatted string"
156         }
157       ]
158     },
159     {
160       "name" : "unicodeClean",
161       "desc" : "Remove invalid unicode characters from a string",
162       "isStatic" : false,
163       "isConstructor" : false,
164       "isPrivate" : false,
165       "memberOf" : "String",
166       "example" : "",
167       "deprecated" : "",
168       "since" : "",
169       "see" : "",
170       "params" : [
171       ],
172       "returns" : [
173         {
174           "name" : "",
175           "type" : "String",
176           "desc" : "The clean string"
177         }
178       ]
179     }
180   ],
181   "events" : [
182   ]
183 }