From 0d1bc6cf7483d2a53c2d5f04d15a0ce3da85f29b Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Thu, 30 Oct 2025 12:00:43 -0400 Subject: str: Add to_upper() + tests Signed-off-by: Andrew Opalach --- include/al/str.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/al/str.h b/include/al/str.h index 6640b0f..cb7c98f 100644 --- a/include/al/str.h +++ b/include/al/str.h @@ -70,6 +70,13 @@ static inline void al_str_to_lower(str *s) } } +static inline void al_str_to_upper(str *s) +{ + for (u32 i = 0; i < s->length; i++) { + al_str_at(s, i) = al_toupper(al_str_at(s, i)); + } +} + // Returned c_str must be free'd by the user. static inline char *al_str_to_c_str(str *s) { @@ -167,6 +174,7 @@ static inline bool al_str_tok(str *result, char delim) return true; } +// djb2 hash. static inline u32 al_str_hash(str *s) { u32 hash = 5381; -- cgit v1.2.3-101-g0448