diff options
| author | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-05-11 13:26:16 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-05-11 13:26:16 +0200 |
| commit | 5392f970f970ba0d5f4642b11935e61653086aae (patch) | |
| tree | 020b881d0b93d3af82d2b4d83e7ca7e44101f052 /src/string_utils.c | |
| parent | 45d1a969f70e1b127eb0aaab94dfce33b18e42ee (diff) | |
work
Diffstat (limited to 'src/string_utils.c')
| -rw-r--r-- | src/string_utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/string_utils.c b/src/string_utils.c index 6709604..6bf1d01 100644 --- a/src/string_utils.c +++ b/src/string_utils.c @@ -224,6 +224,17 @@ inline bool string_equals(char *first, char *second) return (strcmp(first, second) == 0);
}
+s32 string_length(char *str)
+{
+ utf8_int32_t ch = 0;
+ s32 i = 0;
+ while((str = utf8codepoint(str, &ch)) && ch)
+ {
+ i++;
+ }
+ return i;
+}
+
// replaces " with \" for file formats
void string_appendf(char *buffer, char *text)
{
|
