(function(){function append(name,method){if(!String.prototype[name])String.prototype[name]=method}append("trim",function(){return this.replace(/(^\s+|\s+$)/g,"")});append("ltrim",function(){return this.replace(/^\s*/g,"")});append("rtrim",function(){return this.replace(/\s*$/g,"")});append("collapseSpaces",function(){return this.trim().replace(/\s{2,}/g," ").replace(/{(Keyword):\s*(.*?)\s*}/gi,"{$1:$2}")});append("format",function(substrings){var subRegExp=/(?:%(\d+))/mg,currPos=0,r=[];do{var match=subRegExp.exec(this);if(match&&match[1]){if(match.index>currPos)r.push(this.substring(currPos,match.index));r.push(substrings[parseInt(match[1])]);currPos=subRegExp.lastIndex}}while(match);if(currPos0)s=this.substring(0,start);if(start+length0)s+=(separator&&count!=0)?t+separator:t;return s});append("pad",function(length,ch,direction){length=length||30;direction=direction||0;ch=ch||' ';var t=this;while(t.lengthlength?this.slice(0,length-suffix.length)+suffix:this});append("stripTags",function(){return this.replace(/<\/?[^>]+>/gi,'')})})();