MCPcopy Create free account
hub / github.com/Wscats/vscode-explore / getNextCodePoint

Function getNextCodePoint

contributes/src/vs/base/common/strings.ts:477–486  ·  view source on GitHub ↗
(str: string, len: number, offset: number)

Source from the content-addressed store, hash-verified

475 * get the code point that begins at offset `offset`
476 */
477export function getNextCodePoint(str: string, len: number, offset: number): number {
478 const charCode = str.charCodeAt(offset);
479 if (isHighSurrogate(charCode) && offset + 1 < len) {
480 const nextCharCode = str.charCodeAt(offset + 1);
481 if (isLowSurrogate(nextCharCode)) {
482 return computeCodePoint(charCode, nextCharCode);
483 }
484 }
485 return charCode;
486}
487
488/**
489 * get the code point that ends right before offset `offset`

Callers 3

nextCharLengthFunction · 0.85
_getCharContainingOffsetFunction · 0.85
encodeUTF8Function · 0.85

Calls 3

isHighSurrogateFunction · 0.85
isLowSurrogateFunction · 0.85
computeCodePointFunction · 0.85

Tested by

no test coverage detected