summaryrefslogtreecommitdiff
path: root/includes/js/dojo/string.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojo/string.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojo/string.js')
-rw-r--r--includes/js/dojo/string.js84
1 files changed, 0 insertions, 84 deletions
diff --git a/includes/js/dojo/string.js b/includes/js/dojo/string.js
deleted file mode 100644
index a407744..0000000
--- a/includes/js/dojo/string.js
+++ /dev/null
@@ -1,84 +0,0 @@
-if(!dojo._hasResource["dojo.string"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.string"] = true;
-dojo.provide("dojo.string");
-
-/*=====
-dojo.string = {
- // summary: String utilities for Dojo
-};
-=====*/
-
-dojo.string.pad = function(/*String*/text, /*int*/size, /*String?*/ch, /*boolean?*/end){
- // summary:
- // Pad a string to guarantee that it is at least `size` length by
- // filling with the character `ch` at either the start or end of the
- // string. Pads at the start, by default.
- // text: the string to pad
- // size: length to provide padding
- // ch: character to pad, defaults to '0'
- // end: adds padding at the end if true, otherwise pads at start
-
- var out = String(text);
- if(!ch){
- ch = '0';
- }
- while(out.length < size){
- if(end){
- out += ch;
- }else{
- out = ch + out;
- }
- }
- return out; // String
-};
-
-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.
- // description:
- // 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'."
- // template:
- // a string with expressions in the form `${key}` to be replaced or
- // `${key:format}` which specifies a format function.
- // map: hash to search for substitutions
- // transform:
- // a function to process all parameters before substitution takes
- // place, e.g. dojo.string.encodeXML
- // thisObject:
- // where to look for optional format function; default to the global
- // namespace
-
- return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g, function(match, key, format){
- var value = dojo.getObject(key,false,map);
- if(format){ value = dojo.getObject(format,false,thisObject)(value);}
- if(transform){ value = transform(value, key); }
- return value.toString();
- }); // string
-};
-
-dojo.string.trim = function(/*String*/ str){
- // summary: trims whitespaces from both sides of the string
- // description:
- // This version of trim() was taken from [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript).
- // The short yet performant version of this function is
- // dojo.trim(), which is part of Dojo base.
- str = str.replace(/^\s+/, '');
- for(var i = str.length - 1; i > 0; i--){
- if(/\S/.test(str.charAt(i))){
- str = str.substring(0, i + 1);
- break;
- }
- }
- return str; // String
-};
-
-}