Merge from vscode 10492ba146318412cbee8b76a8c630f226914734

This commit is contained in:
ADS Merger
2020-04-08 06:33:38 +00:00
parent fca2344c2e
commit 1868a7d370
339 changed files with 3795 additions and 3146 deletions

View File

@@ -295,11 +295,12 @@ export function compare(a: string, b: string): number {
}
}
export function compareIgnoreCase(a: string, b: string): number {
const len = Math.min(a.length, b.length);
for (let i = 0; i < len; i++) {
let codeA = a.charCodeAt(i);
let codeB = b.charCodeAt(i);
export function compareIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
let codeA = a.charCodeAt(aStart);
let codeB = b.charCodeAt(bStart);
if (codeA === codeB) {
// equal
@@ -329,13 +330,16 @@ export function compareIgnoreCase(a: string, b: string): number {
}
}
if (a.length < b.length) {
const aLen = aEnd - aStart;
const bLen = bEnd - bStart;
if (aLen < bLen) {
return -1;
} else if (a.length > b.length) {
} else if (aLen > bLen) {
return 1;
} else {
return 0;
}
return 0;
}
export function isLowerAsciiLetter(code: number): boolean {