[JavaScript]自己动手为string添加Trim
1<script language=Javascript>
2 String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
3 String.prototype.LTrim = function(){return this.replace(/(^\s*)/g, "");}
4 String.prototype.RTrim = function(){return this.replace(/(\s*$)/g, "");}
5</script>
2 String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
3 String.prototype.LTrim = function(){return this.replace(/(^\s*)/g, "");}
4 String.prototype.RTrim = function(){return this.replace(/(\s*$)/g, "");}
5</script>