Files
orca/src/shared/nul-delimited-fields.ts
T
NeilandOrca c419aadb19 oom(01): A1-shared-readers — reintroduce #10179 subset (#10294)
Files: 18 applied, 0 deleted (from 6eb70d8370)

Co-authored-by: Orca <help@stably.ai>
2026-07-24 20:30:31 -07:00

13 lines
304 B
TypeScript

export function* iterateNulDelimitedFields(value: string): Generator<string> {
let start = 0
while (start <= value.length) {
const end = value.indexOf('\0', start)
if (end === -1) {
yield value.slice(start)
return
}
yield value.slice(start, end)
start = end + 1
}
}