diff options
Diffstat (limited to 'lib/dojo/string.js')
-rw-r--r-- | lib/dojo/string.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/dojo/string.js b/lib/dojo/string.js index 1eba34043..2e1cc5015 100644 --- a/lib/dojo/string.js +++ b/lib/dojo/string.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -9,8 +9,10 @@ if(!dojo._hasResource["dojo.string"]){ //_hasResource checks added by build. Do dojo._hasResource["dojo.string"] = true; dojo.provide("dojo.string"); +dojo.getObject("string", true, dojo); + /*===== -dojo.string = { +dojo.string = { // summary: String utilities for Dojo }; =====*/ @@ -61,22 +63,22 @@ dojo.string.pad = function(/*String*/text, /*Integer*/size, /*String?*/ch, /*Boo return end ? out + pad : pad + out; // String }; -dojo.string.substitute = function( /*String*/ template, - /*Object|Array*/map, - /*Function?*/ transform, +dojo.string.substitute = function( /*String*/ template, + /*Object|Array*/map, + /*Function?*/ transform, /*Object?*/ thisObject){ // summary: // Performs parameterized substitutions on a string. Throws an // exception if any parameter is unmatched. - // template: + // template: // a string with expressions in the form `${key}` to be replaced or - // `${key:format}` which specifies a format function. keys are case-sensitive. + // `${key:format}` which specifies a format function. keys are case-sensitive. // map: // hash to search for substitutions - // transform: + // transform: // a function to process all parameters before substitution takes // place, e.g. mylib.encodeXML - // thisObject: + // thisObject: // where to look for optional format function; default to the global // namespace // example: @@ -119,7 +121,7 @@ dojo.string.substitute = function( /*String*/ template, // | ); thisObject = thisObject || dojo.global; - transform = transform ? + transform = transform ? dojo.hitch(thisObject, transform) : function(v){ return v; }; return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g, |