|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
|
2 <html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#"> |
|
3 <head> |
|
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
|
5 <title>API: substitute YUI~substitute (YUI Library)</title> |
|
6 |
|
7 <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" /> |
|
8 <link rel="stylesheet" type="text/css" href="assets/api.css" /> |
|
9 |
|
10 <script type="text/javascript" src="assets/api-js"></script> |
|
11 <script type="text/javascript" src="assets/ac-js"></script> |
|
12 </head> |
|
13 |
|
14 <body id="yahoo-com"> |
|
15 |
|
16 <div id="doc3" class="yui-t2"> |
|
17 <div id="hd"> |
|
18 <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1> |
|
19 <h3>substitute <span class="subtitle">3.0.0</span></h3> |
|
20 <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> |
|
21 > <a href="./module_substitute.html" title="substitute">substitute</a> |
|
22 > YUI~substitute |
|
23 |
|
24 <form onsubmit="return false"> |
|
25 <div id="propertysearch"> |
|
26 Search: <input autocomplete="off" id="searchinput" /> |
|
27 <div id="searchresults"> |
|
28 |
|
29 </div> |
|
30 </div> |
|
31 </form> |
|
32 </div> |
|
33 |
|
34 <div id="bd"> |
|
35 <div id="yui-main"> |
|
36 <div class="yui-b"> |
|
37 <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form"> |
|
38 <fieldset> |
|
39 <legend>Filters</legend> |
|
40 <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span> |
|
41 <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span> |
|
42 <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span> |
|
43 </fieldset> |
|
44 </form> |
|
45 |
|
46 <h2> |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 Class <b property="yui:name">YUI~substitute</b> |
|
52 <span class="extends"> |
|
53 </span> |
|
54 |
|
55 </h2> |
|
56 <!-- class tree goes here --> |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 <div class="summary description" property="yui:description"> |
|
62 The following methods are added to the YUI instance |
|
63 </div> |
|
64 |
|
65 |
|
66 <div rel="yui:properties" resource="#properties"> |
|
67 |
|
68 </div> |
|
69 |
|
70 <div rel="yui:methods" resource="#methods"> |
|
71 <div class="section method details"> |
|
72 <h3 id="methods">Methods</h3> |
|
73 <div class="content"> |
|
74 <div class="" rel="yui:method" resource="#method_substitute"> |
|
75 <h4> |
|
76 <a name="method_substitute">substitute</a></h4> |
|
77 <div class="detail" > |
|
78 <code> |
|
79 |
|
80 |
|
81 |
|
82 string |
|
83 <strong property="yui:name">substitute</strong> |
|
84 ( |
|
85 |
|
86 |
|
87 s |
|
88 |
|
89 |
|
90 , |
|
91 o |
|
92 |
|
93 |
|
94 , |
|
95 f |
|
96 |
|
97 |
|
98 ) |
|
99 </code> |
|
100 |
|
101 <div class="description" property="yui:description"> |
|
102 Does variable substitution on a string. It scans through the string |
|
103 looking for expressions enclosed in { } braces. If an expression |
|
104 is found, it is used a key on the object. If there is a space in |
|
105 the key, the first word is used for the key and the rest is provided |
|
106 to an optional function to be used to programatically determine the |
|
107 value (the extra information might be used for this decision). If |
|
108 the value for the key in the object, or what is returned from the |
|
109 function has a string value, number value, or object value, it is |
|
110 substituted for the bracket expression and it repeats. If this |
|
111 value is an object, it uses the Object's toString() if this has |
|
112 been overridden, otherwise it does a shallow dump of the key/value |
|
113 pairs if Y.dump is available (if dump isn't available, toString() |
|
114 is used). |
|
115 This method is included in the 'substitute' module. It is not included |
|
116 in the YUI module. |
|
117 </div> |
|
118 |
|
119 <div class="description"> |
|
120 |
|
121 <dl rel="yui:parameters"> |
|
122 <dt>Parameters:</dt> |
|
123 <dd rel="yui:parameter"> |
|
124 <code><span property="yui:name">s</span> |
|
125 <<span property="yui:type">string</span>> |
|
126 </code> |
|
127 <span property="yui:description"> The string that will be modified.</span> |
|
128 </dd> |
|
129 <dd rel="yui:parameter"> |
|
130 <code><span property="yui:name">o</span> |
|
131 <<span property="yui:type">object</span>> |
|
132 </code> |
|
133 <span property="yui:description"> An object containing the replacement values</span> |
|
134 </dd> |
|
135 <dd rel="yui:parameter"> |
|
136 <code><span property="yui:name">f</span> |
|
137 <<span property="yui:type">function</span>> |
|
138 </code> |
|
139 <span property="yui:description"> An optional function that can be used to |
|
140 process each match. It receives the key, |
|
141 value, and any extra metadata included with |
|
142 the key inside of the braces.</span> |
|
143 </dd> |
|
144 </dl> |
|
145 |
|
146 <dl> |
|
147 <dt>Returns: |
|
148 <code property="yui:return"> |
|
149 string |
|
150 </code></dt> |
|
151 <dd property="yui:returnInfo">the substituted string</dd> |
|
152 </dl> |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 </div> |
|
158 |
|
159 </div> |
|
160 <hr /> |
|
161 </div> |
|
162 </div> |
|
163 </div> |
|
164 |
|
165 </div> |
|
166 |
|
167 <div rel="yui:events" resource="#events"> |
|
168 |
|
169 |
|
170 </div> |
|
171 |
|
172 <div rel="yui:attributes" resource="#configattributes"> |
|
173 |
|
174 </div> |
|
175 |
|
176 </div> |
|
177 </div> |
|
178 <div class="yui-b"> |
|
179 <div class="nav"> |
|
180 |
|
181 <div id="moduleList" class="module"> |
|
182 <h4>Modules</h4> |
|
183 <ul class="content"> |
|
184 <li class=""><a href="module_anim.html" title="anim">anim</a></li> |
|
185 <li class=""><a href="module_async-queue.html" title="async-queue">async-queue</a></li> |
|
186 <li class=""><a href="module_attribute.html" title="attribute">attribute</a></li> |
|
187 <li class=""><a href="module_base.html" title="base">base</a></li> |
|
188 <li class=""><a href="module_cache.html" title="cache">cache</a></li> |
|
189 <li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li> |
|
190 <li class=""><a href="module_collection.html" title="collection">collection</a></li> |
|
191 <li class=""><a href="module_console.html" title="console">console</a></li> |
|
192 <li class=""><a href="module_console-filters.html" title="console-filters">console-filters</a></li> |
|
193 <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li> |
|
194 <li class=""><a href="module_dataschema.html" title="dataschema">dataschema</a></li> |
|
195 <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li> |
|
196 <li class=""><a href="module_datatype.html" title="datatype">datatype</a></li> |
|
197 <li class=""><a href="module_dd.html" title="dd">dd</a></li> |
|
198 <li class=""><a href="module_dom.html" title="dom">dom</a></li> |
|
199 <li class=""><a href="module_dump.html" title="dump">dump</a></li> |
|
200 <li class=""><a href="module_event.html" title="event">event</a></li> |
|
201 <li class=""><a href="module_event-custom.html" title="event-custom">event-custom</a></li> |
|
202 <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li> |
|
203 <li class=""><a href="module_history.html" title="history">history</a></li> |
|
204 <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li> |
|
205 <li class=""><a href="module_io.html" title="io">io</a></li> |
|
206 <li class=""><a href="module_json.html" title="json">json</a></li> |
|
207 <li class=""><a href="module_node.html" title="node">node</a></li> |
|
208 <li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li> |
|
209 <li class=""><a href="module_node-menunav.html" title="node-menunav">node-menunav</a></li> |
|
210 <li class=""><a href="module_oop.html" title="oop">oop</a></li> |
|
211 <li class=""><a href="module_overlay.html" title="overlay">overlay</a></li> |
|
212 <li class=""><a href="module_plugin.html" title="plugin">plugin</a></li> |
|
213 <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li> |
|
214 <li class=""><a href="module_queue-promote.html" title="queue-promote">queue-promote</a></li> |
|
215 <li class=""><a href="module_slider.html" title="slider">slider</a></li> |
|
216 <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li> |
|
217 <li class="selected"><a href="module_substitute.html" title="substitute">substitute</a></li> |
|
218 <li class=""><a href="module_test.html" title="test">test</a></li> |
|
219 <li class=""><a href="module_widget.html" title="widget">widget</a></li> |
|
220 <li class=""><a href="module_widget-position.html" title="widget-position">widget-position</a></li> |
|
221 <li class=""><a href="module_widget-position-ext.html" title="widget-position-ext">widget-position-ext</a></li> |
|
222 <li class=""><a href="module_widget-stack.html" title="widget-stack">widget-stack</a></li> |
|
223 <li class=""><a href="module_widget-stdmod.html" title="widget-stdmod">widget-stdmod</a></li> |
|
224 <li class=""><a href="module_yui.html" title="yui">yui</a></li> |
|
225 </ul> |
|
226 </div> |
|
227 |
|
228 <div id="classList" class="module"> |
|
229 <h4>Classes</h4> |
|
230 <ul class="content"> |
|
231 <li class="selected"><a href="YUI~substitute.html" title="YUI~substitute">YUI~substitute</a></li> |
|
232 </ul> |
|
233 </div> |
|
234 |
|
235 <div id="fileList" class="module"> |
|
236 <h4>Files</h4> |
|
237 <ul class="content"> |
|
238 <li class=""><a href="substitute.js.html" title="substitute.js">substitute.js</a></li> |
|
239 </ul> |
|
240 </div> |
|
241 |
|
242 |
|
243 <div id="methodsList" class="module"> |
|
244 <h4>Methods</h4> |
|
245 <ul class="content"> |
|
246 <li class=""><a href="#method_substitute" title="substitute">substitute</a></li> |
|
247 </ul> |
|
248 </div> |
|
249 |
|
250 |
|
251 |
|
252 </div> |
|
253 </div> |
|
254 </div> |
|
255 <div id="ft"> |
|
256 <hr /> |
|
257 Copyright © 2009 Yahoo! Inc. All rights reserved. |
|
258 </div> |
|
259 </div> |
|
260 <script type="text/javascript"> |
|
261 ALL_YUI_PROPS = [{"access": "", "host": "YUI~substitute", "name": "substitute", "url": "YUI~substitute.html#method_substitute", "type": "method"}]; |
|
262 </script> |
|
263 </body> |
|
264 </html> |