Files: 18 applied, 0 deleted (from 6eb70d8370)
Co-authored-by: Orca <help@stably.ai>
13 lines
304 B
TypeScript
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
|
|
}
|
|
}
|