


String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/g, "");  
}

String.prototype.replaceAll = function(AFindText,ARepText)
{
	raRegExp = new RegExp(AFindText,"g"); 
	return this.replace(raRegExp,ARepText);
}

String.prototype.getClass=function(){
  return "String";
}

String.prototype.equalsIgnoreCase = function(str){
 if(str.getClass()!="String") return false;
 return this.toUpperCase()===str.toUpperCase();
}

String.prototype.compareTo=function(str){
 if(!this.typeMatches(str)) throw "Type Mismacth!";
 var s1=this.toString();
 var s2=str.toString();
 if(s1===s2) return 0;
 else if(s1>s2) return 1;
 else return -1;
}

String.prototype.compareToIgnoreCase=function(str){
 if(!this.typeMatches(str)) throw "Type Mismacth!";
 var s1=this.toUpperCase();
 var s2=str.toUpperCase();
 if(s1===s2) return 0;
 else if(s1>s2) return 1;
 else return -1;
}


String.prototype.startsWith=function(prefix){
 return this.substring(0,prefix.length)==prefix;
}
String.prototype.endsWith=function(suffix){
 return this.substring(this.length-suffix.length)==suffix;
}

String.prototype.concat=function(str){
 return new String(this.toString()+str);
}

String.prototype.cut=function(len){
  var temLen = this.length;
  if(temLen<=len) return this;
  return this.substring(0,len)+"..."; 
}

String.prototype.toCharArray=function(){
 var charArr=new Array();
 for(var i=0;i<this.length;i++) charArr[i]=this.charAt(i);
 return charArr;
}

String.prototype.toInteger = function(){
   
}

String.prototype.isNullOrEmpty=function(){
 if(this==null || this=='undefined') return true;
 return this.trim().equalsIgnoreCase('');
}

function StringBuffer() {
 this.array = new Array();
}

StringBuffer.prototype.append=function(str) {
  this.array.push(str);
}

StringBuffer.prototype.toString=function(){
  return this.array.join(""); 
}



String.prototype.encode=function(){
 return encodeURIComponent(this);
}
//是否是数字
String.prototype.isInteger=function(){ 
   
   return true; 
}

var  Util = { 
 
 isInteger: function(ob) {
    var firstTest = (ob instanceof Number || typeof ob == "number");
    if (!firstTest) {
      var stI = "" + ob; 
      var number=0;
      if (stI.length == 0) {
        return false;
      }
     for (var i = 0; i < stI.length; i++) {
        var ch = stI.charAt(i);
        if ("0123456789" .indexOf(ch) ==  - 1) {
            return false;
        }
        if(ch=='-' && (i!=0) ) {
           return false;
        }
      }
     return true;
    } 
     return true;
  },
  biggerThanZero:function(obj){
    if(obj>0) return true; 
    return false;
  }
}
