dojo.string.substitute
dojo.require("dojo.string");
defined in dojo/string.js
For example,
dojo.string.substitute("File '${0}' is not found in directory '${1}'.",["foo.html","/temp"]);
dojo.string.substitute("File '${name}' is not found in directory '${info.dir}'.",
{name: "foo.html", info: {dir: "/temp"}});
both return
"File 'foo.html' is not found in directory '/temp'."
Usage
parameter | type | description |
---|---|---|
template | String | a string with expressions in the form `${key}` to be replaced or `${key:format}` which specifies a format function. |
map | Object|Array | hash to search for substitutions |
transform | Function | Optional. a function to process all parameters before substitution takes place, e.g. dojo.string.encodeXML |
thisObject | Object | Optional. where to look for optional format function; default to the global namespace |