String: refactor isAllWhitespace into String

This commit is contained in:
Adrià Arrufat
2026-03-06 15:52:26 +09:00
parent 248851701f
commit 471ba5baf6
3 changed files with 11 additions and 16 deletions

View File

@@ -305,6 +305,12 @@ pub const String = packed struct {
}
};
pub fn isAllWhitespace(text: []const u8) bool {
return for (text) |c| {
if (!std.ascii.isWhitespace(c)) break false;
} else true;
}
// Discriminatory type that signals the bridge to use arena instead of call_arena
// Use this for strings that need to persist beyond the current call
// The caller can unwrap and store just the underlying .str field