mirror of
https://github.com/CarlGao4/um-react-electron.git
synced 2025-05-23 16:27:43 +08:00
10 lines
177 B
TypeScript
10 lines
177 B
TypeScript
export function strlen(data: Uint8Array): number {
|
|
const n = data.byteLength;
|
|
for (let i = 0; i < n; i++) {
|
|
if (data[i] === 0) {
|
|
return i;
|
|
}
|
|
}
|
|
return n;
|
|
}
|