String.prototype.trim = function() {
return this.replace( /^\s*|\s*$/g, "" );
}
String.prototype.addslashes = function () {
return this.replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}
iOS Developer
Monday, May 4, 2009
two useful String extend functions.
Tags:
javascript,
prototype
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment