//String.prototype use
//Batch Replacement, for example: str.ReplaceAll([/a/g,/b/g,/c/g],["aaa","bbb","ccc"])
String.prototype.ReplaceAll=function ( A,B) {
var C=this;
for(var i=0;i
C=C.replace(A[i],B[i] );
};
return C; .replace(/(^[/t/n/r]*)|([/t/n/r]*$)/g,'');
};
// Remove The blank character to the left of the character
String.prototype.LTrim=function () {
return this.replace(/^[/t/n/r]/g,'');
};
// Remove the blank characters on the right side of the character
String.prototype.RTrim=function () {
return this.replace(/[/t/n/r]*$/g,'') ;
};
// Return the length of characters, one Chinese character is counted as 2
String.prototype.ChineseLength=function()
{
return this.replace(/[ ^/x00-/xff]/g,"**").length;
};
// Determine whether the string ends with the specified string
String.prototype.EndsWith= function (A,B) {
var C=this.length;
var D=A.length;
if(D>C)return false;
if(B) {
var E=new RegExp(A '$','i');
return E.test(this);
}else return (D==0||this.substr(C-D,D)== A);
};
// Determine whether the string starts with the specified string
String.prototype.StartsWith = function(str)
{
return this.substr(0, str.length) == str; ';
if(A>0)s=this.substring(0,A);
if(A B return s;
};