feat(facade): toUpperCase and toLowerCase
This commit is contained in:
parent
c47902a471
commit
557d54b3de
|
@ -64,6 +64,14 @@ class StringWrapper {
|
||||||
return s.replaceAll(from, replace);
|
return s.replaceAll(from, replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String toUpperCase(String s) {
|
||||||
|
return s.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
static String toLowerCase(String s) {
|
||||||
|
return s.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
static startsWith(String s, String start) {
|
static startsWith(String s, String start) {
|
||||||
return s.startsWith(start);
|
return s.startsWith(start);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,10 @@ export class StringWrapper {
|
||||||
return s.replace(from, replace);
|
return s.replace(from, replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static toUpperCase(s: string): string { return s.toUpperCase(); }
|
||||||
|
|
||||||
|
static toLowerCase(s: string): string { return s.toLowerCase(); }
|
||||||
|
|
||||||
static startsWith(s: string, start: string) { return s.startsWith(start); }
|
static startsWith(s: string, start: string) { return s.startsWith(start); }
|
||||||
|
|
||||||
static substring(s: string, start: int, end: int = null) {
|
static substring(s: string, start: int, end: int = null) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {isPresent, RegExpWrapper, RegExpMatcherWrapper, CONST_EXPR} from 'angular2/src/facade/lang';
|
import {isPresent, RegExpWrapper, RegExpMatcherWrapper, StringWrapper, CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('RegExp', () => {
|
describe('RegExp', () => {
|
||||||
|
@ -29,4 +29,25 @@ export function main() {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('String', () => {
|
||||||
|
var upper, lower;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
upper = 'SOMETHING'
|
||||||
|
lower = 'something';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should upper case a string', () => {
|
||||||
|
var str = StringWrapper.toUpperCase(lower);
|
||||||
|
|
||||||
|
expect(str).toEqual(upper);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should lower case a string', () => {
|
||||||
|
var str = StringWrapper.toLowerCase(upper);
|
||||||
|
|
||||||
|
expect(str).toEqual(lower);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue