add stripLeft and stripRight

This commit is contained in:
Luca Martinetti 2016-10-12 16:37:03 -07:00
parent bc150e1372
commit 024808fa0d
2 changed files with 11 additions and 0 deletions

4
string/index.d.ts vendored
View File

@ -72,6 +72,10 @@ interface StringJS {
strip(...strings: string[]): StringJS;
stripLeft(...strings: string[]): StringJS;
stripRight(...strings: string[]): StringJS;
right(n: number): StringJS;
setValue(string: any): StringJS;

View File

@ -164,6 +164,13 @@ S('Yes it does!').replaceAll(' ', '').s; //'Yesitdoes!'
S(' 1 2 3--__--4 5 6-7__8__9--0').strip(' ', '_', '-').s; //'1234567890'
S('can words also be stripped out?').strip('words', 'also', 'be').s; //'can stripped out?'
S(' hello ').stripLeft().s; //'hello '
S('abcz').stripLeft('a-z').s; //'bcz'
S('www.example.com').stripLeft('w.').s; //'example.com'
S(' hello ').stripRight().s; //' hello'
S('abcz').stripRight('a-z').s; //'abc'
S('I AM CRAZY').right(2).s; //'ZY'
S('Does it work? ').right(4).s; //'k? '
S('Hi').right(0).s; //''