Updated ascii.zig's isWhitespace function to use switch instead of for loop. (#22094)

This commit is contained in:
Rohan Vashisht
2024-11-30 01:56:23 +05:30
committed by GitHub
parent 07cd488d42
commit 88d57917b7

View File

@@ -135,10 +135,10 @@ pub fn isPrint(c: u8) bool {
/// Returns whether this character is included in `whitespace`.
pub fn isWhitespace(c: u8) bool {
return for (whitespace) |other| {
if (c == other)
break true;
} else false;
return switch (c) {
' ', '\t'...'\r' => true,
else => false,
};
}
/// Whitespace for general use.