mirror of
https://codeberg.org/Tilo-K/tk_sfl.git
synced 2026-10-18 13:57:10 +00:00
feat: add tk_strings
This commit is contained in:
2 files changed
+303
No files matched your search
+23
@@ -22,3 +22,26 @@ int main() {
|
||||
|
||||
Define DEBUG to initalize memory with OXFE, to detect uninitialized memory.
|
||||
Define DEBUG AND TK_MEMORY_TRACK to catch memory leaks when calling tk_check_memory_leaks().
|
||||
|
||||
|
||||
*** tk_strings.h ***
|
||||
```
|
||||
#define TK_STRINGS_IMPLEMENTATION
|
||||
#include "tk_strings.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
char str[] = " Hello, World ";
|
||||
tk_str_to_lower(str);
|
||||
|
||||
char* trimmed = tk_str_trim(str);
|
||||
uint8_t contains = tk_str_contains(trimmed, "hello");
|
||||
|
||||
free(trimmed);
|
||||
return contains ? 0 : 1;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
String utilities include counting characters/substrings, splitting by character or substring, case conversion, concatenation, trimming, and substring checks.
|
||||
Reference in new issue
Block a user