strUtil.js 371 B

12345678910111213141516
  1. //À©Õ¹StringÀ๦ÄÜ
  2. //ɾ³ý×Ö·û´®¶þ±ß¿Õ¸ñ
  3. String.prototype.trim = function()
  4. {
  5. return this.replace(/(^[\s]*)|([\s]*$)/g, "");
  6. };
  7. //ɾ³ý×Ö·û´®×ó±ß¿Õ¸ñ
  8. String.prototype.lTrim = function()
  9. {
  10. return this.replace(/(^[\s]*)/g, "");
  11. };
  12. //ɾ³ý×Ö·û´®Óұ߿ոñ
  13. String.prototype.rTrim = function()
  14. {
  15. return this.replace(/([\s]*$)/g, "");
  16. };