enable grammerly in editor
[roojs1] / docs / symbols / String.json
1 {
2   "name" : "String",
3   "augments" : [],
4   "desc" : "",
5   "isSingleton" : false,
6   "isStatic" : false,
7   "isBuiltin" : true,
8   "memberOf" : "String",
9   "example" : "",
10   "deprecated" : "",
11   "since" : "",
12   "see" : "",
13   "params" : [],
14   "returns" : [],
15   "config" : [],
16   "methods" : [
17     {
18       "name" : "escape",
19       "desc" : "Escapes the passed string for ' and \\",
20       "isStatic" : true,
21       "isConstructor" : false,
22       "isPrivate" : false,
23       "memberOf" : "String",
24       "example" : "",
25       "deprecated" : "",
26       "since" : "",
27       "see" : "",
28       "params" : [
29         {
30           "name" : "string",
31           "type" : "String",
32           "desc" : "The string to escape",
33           "isOptional" : false
34         }
35       ],
36       "returns" : [
37         {
38           "name" : "",
39           "type" : "String",
40           "desc" : "The escaped string"
41         }
42       ]
43     },
44     {
45       "name" : "leftPad",
46       "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>",
47       "isStatic" : true,
48       "isConstructor" : false,
49       "isPrivate" : false,
50       "memberOf" : "String",
51       "example" : "",
52       "deprecated" : "",
53       "since" : "",
54       "see" : "",
55       "params" : [
56         {
57           "name" : "string",
58           "type" : "String",
59           "desc" : "The original string",
60           "isOptional" : false
61         },
62         {
63           "name" : "size",
64           "type" : "Number",
65           "desc" : "The total length of the output string",
66           "isOptional" : false
67         },
68         {
69           "name" : "char",
70           "type" : "String",
71           "desc" : "(optional) The character with which to pad the original string (defaults to empty string \" \")",
72           "isOptional" : false
73         }
74       ],
75       "returns" : [
76         {
77           "name" : "",
78           "type" : "String",
79           "desc" : "The padded string"
80         }
81       ]
82     },
83     {
84       "name" : "toggle",
85       "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>",
86       "isStatic" : false,
87       "isConstructor" : false,
88       "isPrivate" : false,
89       "memberOf" : "String",
90       "example" : "",
91       "deprecated" : "",
92       "since" : "",
93       "see" : "",
94       "params" : [
95         {
96           "name" : "value",
97           "type" : "String",
98           "desc" : "The value to compare to the current string",
99           "isOptional" : false
100         },
101         {
102           "name" : "other",
103           "type" : "String",
104           "desc" : "The new value to use if the string already equals the first value passed in",
105           "isOptional" : false
106         }
107       ],
108       "returns" : [
109         {
110           "name" : "",
111           "type" : "String",
112           "desc" : "The new value"
113         }
114       ]
115     },
116     {
117       "name" : "format",
118       "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>",
119       "isStatic" : true,
120       "isConstructor" : false,
121       "isPrivate" : false,
122       "memberOf" : "String",
123       "example" : "",
124       "deprecated" : "",
125       "since" : "",
126       "see" : "",
127       "params" : [
128         {
129           "name" : "string",
130           "type" : "String",
131           "desc" : "The tokenized string to be formatted",
132           "isOptional" : false
133         },
134         {
135           "name" : "value1",
136           "type" : "String",
137           "desc" : "The value to replace token {0}",
138           "isOptional" : false
139         },
140         {
141           "name" : "value2",
142           "type" : "String",
143           "desc" : "Etc...",
144           "isOptional" : false
145         }
146       ],
147       "returns" : [
148         {
149           "name" : "",
150           "type" : "String",
151           "desc" : "The formatted string"
152         }
153       ]
154     },
155     {
156       "name" : "unicodeClean",
157       "desc" : "Remove invalid unicode characters from a string",
158       "isStatic" : false,
159       "isConstructor" : false,
160       "isPrivate" : false,
161       "memberOf" : "String",
162       "example" : "",
163       "deprecated" : "",
164       "since" : "",
165       "see" : "",
166       "params" : [],
167       "returns" : [
168         {
169           "name" : "",
170           "type" : "String",
171           "desc" : "The clean string"
172         }
173       ]
174     }
175   ],
176   "events" : []
177 }