376
377
export function compareSubstringIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {
379
>
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
380
>
381
>
let codeA = a.charCodeAt(aStart);
382
>
let codeB = b.charCodeAt(bStart);
383
>
384
>
if (codeA === codeB) {
385
// equal
386
continue;
387
}
388
389
>
if (codeA >= 128 || codeB >= 128) {
strings.ts
390
// not ASCII letters -> fallback to lower-casing strings
391
return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);