Javascript modifies String object to add whitespace removing function of sample code


//#region removes whitespace
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