Loading

JavaScript trim 实现去除字符串首尾指定字符的简单方法

String.prototype.trim = function (char, type) { if (char) { if (type == 'left') { return this.replace(new RegExp('^\\'+char+'+', 'g'), ''); } else if (type == 'right') { return ...
posted @ 2017-12-22 10:56  jevan  阅读(3670)  评论(0编辑  收藏  举报