去除两端空格的方法
摘要:// 增加一个名为 trim 的函数作为// String 构造函数的原型对象的一个方法。String.prototype.trim = function(){// 用正则表达式将前后空格// 用空字符串替代。return this.replace(/(^\s*)|(\s*$)/g, "");}// 有空格的字符串var s = " leading and trailing spaces ";//...
阅读全文
posted @ 2004-09-28 15:17
浙公网安备 33010602011771号