PadLeft
TrimStart
TrimEnd
ToDate
String.prototype.PadLeft = function (num, char) {
char = char || '0';
let charString = char.repeat(num);
return (this + charString).slice(-1 * len);
}
String.prototype.TrimStart = function (str) {
if (str) {
var reg = new RegExp('^' + str);
return this.replace(reg, '');
}
else {
if (this.trimStart) {
return this.trimStart();
}
else {
return this.replace(/^\s*/, '');
}
}
}
String.prototype.TrimEnd = function (str) {
if (str) {
var reg = new RegExp(str + '$');
return this.replace(reg, '');
}
else {
if (this.trimEnd) {
return this.trimEnd();
}
else {
return this.replace(/\s$/, '');
}
}
}
String.prototype.ToDate = function () {
return new Date(this);
}