projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a7c54c
)
added: u8.to_upper and u8.to_lower
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 11 May 2023 16:46:51 +0000
(11:46 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 11 May 2023 16:46:51 +0000
(11:46 -0500)
core/string/char_utils.onyx
patch
|
blob
|
history
diff --git
a/core/string/char_utils.onyx
b/core/string/char_utils.onyx
index 800913f374b2deed3cb53b1b398f209c96a6df54..0a79830d2dba5001617fe63610eef1e58456c0f5 100644
(file)
--- 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;
+ }
}