mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 10492ba146318412cbee8b76a8c630f226914734
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user