diff options
| author | 2025-10-30 12:00:43 -0400 | |
|---|---|---|
| committer | 2025-10-30 12:21:14 -0400 | |
| commit | 0d1bc6cf7483d2a53c2d5f04d15a0ce3da85f29b (patch) | |
| tree | 4839b7779c8feb46e390d77d010f9d2a4e64a198 /include/al | |
| parent | 4a642e343b57020914f16bd1ced797472d0f95a9 (diff) | |
| download | libalabaster-0d1bc6cf7483d2a53c2d5f04d15a0ce3da85f29b.tar.gz libalabaster-0d1bc6cf7483d2a53c2d5f04d15a0ce3da85f29b.tar.bz2 libalabaster-0d1bc6cf7483d2a53c2d5f04d15a0ce3da85f29b.zip | |
str: Add to_upper() + tests
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include/al')
| -rw-r--r-- | include/al/str.h | 8 |
1 files changed, 8 insertions, 0 deletions
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; |