Skip to content

Commit 74b9e5b

Browse files
committed
debt - remove unused strings#overlap
1 parent 614a35c commit 74b9e5b

2 files changed

Lines changed: 0 additions & 46 deletions

File tree

src/vs/base/common/strings.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -428,43 +428,6 @@ export function commonSuffixLength(a: string, b: string): number {
428428
return len;
429429
}
430430

431-
function substrEquals(a: string, aStart: number, aEnd: number, b: string, bStart: number, bEnd: number): boolean {
432-
while (aStart < aEnd && bStart < bEnd) {
433-
if (a[aStart] !== b[bStart]) {
434-
return false;
435-
}
436-
aStart += 1;
437-
bStart += 1;
438-
}
439-
return true;
440-
}
441-
442-
/**
443-
* Return the overlap between the suffix of `a` and the prefix of `b`.
444-
* For instance `overlap("foobar", "arr, I'm a pirate") === 2`.
445-
*/
446-
export function overlap(a: string, b: string): number {
447-
const aEnd = a.length;
448-
let bEnd = b.length;
449-
let aStart = aEnd - bEnd;
450-
451-
if (aStart === 0) {
452-
return a === b ? aEnd : 0;
453-
} else if (aStart < 0) {
454-
bEnd += aStart;
455-
aStart = 0;
456-
}
457-
458-
while (aStart < aEnd && bEnd > 0) {
459-
if (substrEquals(a, aStart, aEnd, b, 0, bEnd)) {
460-
return bEnd;
461-
}
462-
bEnd -= 1;
463-
aStart += 1;
464-
}
465-
return 0;
466-
}
467-
468431
// --- unicode
469432
// http://en.wikipedia.org/wiki/Surrogate_pair
470433
// Returns the code point starting at a specified index in a string

src/vs/base/test/common/strings.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,6 @@ suite('Strings', () => {
9292
assert.strictEqual(strings.format('Foo {0} Bar. {1}', '(foo)', '.test'), 'Foo (foo) Bar. .test');
9393
});
9494

95-
test('overlap', () => {
96-
assert.equal(strings.overlap('foobar', 'arr, I am a priate'), 2);
97-
assert.equal(strings.overlap('no', 'overlap'), 1);
98-
assert.equal(strings.overlap('no', '0verlap'), 0);
99-
assert.equal(strings.overlap('nothing', ''), 0);
100-
assert.equal(strings.overlap('', 'nothing'), 0);
101-
assert.equal(strings.overlap('full', 'full'), 4);
102-
assert.equal(strings.overlap('full', 'fulloverlap'), 4);
103-
});
10495
test('lcut', () => {
10596
assert.strictEqual(strings.lcut('foo bar', 0), '');
10697
assert.strictEqual(strings.lcut('foo bar', 1), 'bar');

0 commit comments

Comments
 (0)