andrew4582

String.prototype

Dec 12th, 2010
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String.prototype.add = function (A) {
  2.     return this + A
  3. };
  4. String.prototype.trim = function () {
  5.     return this.replace(/^\s+|\s+$/g, "")
  6. };
  7. String.prototype.truncWithEllipis = function (B) {
  8.     var A = this.trim();
  9.     return [A.substring(0, B), "..."].join("")
  10. };
  11. String.prototype.stripHTML = function () {
  12.     return this.replace(/(<([^>]+)>)/ig, "")
  13. };
Advertisement
Add Comment
Please, Sign In to add comment