From: Brendan Hansen Date: Thu, 11 May 2023 16:46:51 +0000 (-0500) Subject: added: u8.to_upper and u8.to_lower X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=bb81cec76d87f671828840c23d910bb4e28d2e95;p=onyx.git added: u8.to_upper and u8.to_lower --- diff --git a/core/string/char_utils.onyx b/core/string/char_utils.onyx index 800913f3..0a79830d 100644 --- a/core/string/char_utils.onyx +++ b/core/string/char_utils.onyx @@ -25,6 +25,16 @@ package core.string is_whitespace :: (c: u8) -> bool { return c == #char " " || c == #char "\n" || c == #char "\t" || c == #char "\v"; } + + to_upper :: (c: u8) -> u8 { + if c >= 'a' && c <= 'z' do return c - 32; + return c; + } + + to_lower :: (c: u8) -> u8 { + if c >= 'A' && c <= 'Z' do return c + 32; + return c; + } }