Add trimStart/End aliases (#287)

This commit is contained in:
Max Graey
2018-09-30 23:21:34 +03:00
committed by Daniel Wirtz
parent 301734b929
commit 2874fb9d8a
7 changed files with 29 additions and 15 deletions

View File

@ -482,6 +482,8 @@ declare class String {
trim(): string;
trimLeft(): string;
trimRight(): string;
trimStart(): string;
trimEnd(): string;
padStart(targetLength: i32, padString?: string): string;
padEnd(targetLength: i32, padString?: string): string;
repeat(count?: i32): string;

View File

@ -303,7 +303,17 @@ export class String {
return out;
}
@inline
trimLeft(): String {
return this.trimStart();
}
@inline
trimRight(): String {
return this.trimEnd();
}
trimStart(): String {
assert(this !== null);
var start: isize = 0;
var len: isize = this.length;
@ -323,7 +333,7 @@ export class String {
return out;
}
trimRight(): String {
trimEnd(): String {
assert(this !== null);
var len: isize = this.length;
while (