Changeset 12859
- Timestamp:
- 03/03/08 17:54:37 (10 months ago)
- Files:
-
- 1 modified
-
dojo/trunk/string.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dojo/trunk/string.js
r11695 r12859 9 9 dojo.string.pad = function(/*String*/text, /*int*/size, /*String?*/ch, /*boolean?*/end){ 10 10 // summary: 11 // Pad a string to guarantee that it is at least 'size'length by12 // filling with the character 'c'at either the start or end of the11 // Pad a string to guarantee that it is at least `size` length by 12 // filling with the character `ch` at either the start or end of the 13 13 // string. Pads at the start, by default. 14 14 // text: the string to pad … … 32 32 33 33 dojo.string.substitute = function( /*String*/template, 34 /*Object orArray*/map,34 /*Object|Array*/map, 35 35 /*Function?*/transform, 36 36 /*Object?*/thisObject){ … … 41 41 // For example, 42 42 // | dojo.string.substitute("File '${0}' is not found in directory '${1}'.",["foo.html","/temp"]); 43 // | dojo.string.substitute("File '${name}' is not found in directory '${info.dir}'.",{name: "foo.html", info: {dir: "/temp"}}); 43 // | dojo.string.substitute("File '${name}' is not found in directory '${info.dir}'.", 44 // | {name: "foo.html", info: {dir: "/temp"}}); 44 45 // both return 45 // "File 'foo.html' is not found in directory '/temp'."46 // | "File 'foo.html' is not found in directory '/temp'." 46 47 // template: 47 // a string with expressions in the form ${key} to be replaced or 48 // ${key:format} which specifies a format function. NOTE syntax has 49 // changed from %{key} 50 // map: where to look for substitutions 48 // a string with expressions in the form `${key}` to be replaced or 49 // `${key:format}` which specifies a format function. 50 // map: hash to search for substitutions 51 51 // transform: 52 52 // a function to process all parameters before substitution takes … … 67 67 // summary: trims whitespaces from both sides of the string 68 68 // description: 69 // This version of trim() was taken from Steven Levithan's blog: 70 // http://blog.stevenlevithan.com/archives/faster-trim-javascript. 71 // The short yet good-performing version of this function is 72 // dojo.trim(), which is part of the base. 69 // This version of trim() was taken from [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript). 70 // The short yet performant version of this function is 71 // dojo.trim(), which is part of Dojo base. 73 72 str = str.replace(/^\s+/, ''); 74 73 for(var i = str.length - 1; i > 0; i--){