Javascript String Method
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.htmlEntities = function () {
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
}
String.prototype.stripTags = function () {
return this.replace(/<([^>]+)>/g,'');
}
String.prototype.esc = function () {
return encodeURIComponent ? encodeURIComponent(this) : escape(this);
}
0 Comments