Welcome 微信登录

首页 / 脚本样式 / JavaScript / Javascript 修改String 对象 增加去除空格功能(示例代码)

复制代码 代码如下:
//#region 去除空格
String.prototype.Trim = function () {
    return this.replace(/(^s*)|(s*$)/g, "");
}


String.prototype.LTrim = function () {
    return this.replace(/(^s*)/g, "");
}


String.prototype.RTrim = function () {
    return this.replace(/(s*$)/g, "");
}
//#endregion