123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- define("dojox/string/Builder", ["dojo/_base/lang"],
- function(lang){
- lang.getObject("string", true, dojox).Builder =
- function(/*String?*/str){
-
-
-
-
-
-
-
- var b = "";
- this.length = 0;
-
- this.append = function(/* String... */s){
-
- if(arguments.length>1){
-
- var tmp="", l=arguments.length;
- switch(l){
- case 9: tmp=""+arguments[8]+tmp;
- case 8: tmp=""+arguments[7]+tmp;
- case 7: tmp=""+arguments[6]+tmp;
- case 6: tmp=""+arguments[5]+tmp;
- case 5: tmp=""+arguments[4]+tmp;
- case 4: tmp=""+arguments[3]+tmp;
- case 3: tmp=""+arguments[2]+tmp;
- case 2: {
- b+=""+arguments[0]+arguments[1]+tmp;
- break;
- }
- default: {
- var i=0;
- while(i<arguments.length){
- tmp += arguments[i++];
- }
- b += tmp;
- }
- }
- } else {
- b += s;
- }
- this.length = b.length;
- return this;
- };
-
- this.concat = function(/*String...*/s){
-
-
- return this.append.apply(this, arguments);
- };
-
- this.appendArray = function(/*Array*/strings) {
-
-
-
- return this.append.apply(this, strings);
- };
-
- this.clear = function(){
-
-
- b = "";
- this.length = 0;
- return this;
- };
-
- this.replace = function(/* String */oldStr, /* String */ newStr){
-
-
- b = b.replace(oldStr,newStr);
- this.length = b.length;
- return this;
- };
-
- this.remove = function(/* Number */start, /* Number? */len){
-
-
-
- if(len===undefined){ len = b.length; }
- if(len == 0){ return this; }
- b = b.substr(0, start) + b.substr(start+len);
- this.length = b.length;
- return this;
- };
-
- this.insert = function(/* Number */index, /* String */str){
-
-
- if(index == 0){
- b = str + b;
- }else{
- b = b.slice(0, index) + str + b.slice(index);
- }
- this.length = b.length;
- return this;
- };
-
- this.toString = function(){
-
-
- return b;
- };
-
- if(str){ this.append(str); }
- };
- return dojox.string.Builder;
- });
|