summaryrefslogtreecommitdiff
path: root/src/string.h
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-09-09 13:34:03 -0700
committersteven-na <noreply.github@stvnc.dev>2026-09-09 13:34:03 -0700
commitb5f1cb4e373f859c41ec32d6fdb9b3c4597e37c2 (patch)
treeb96b118e47084b39210d6583c43cd3e67a390539 /src/string.h
parent81caeb5ffc0748273157bf26c3299dfee9c12a6d (diff)
sv procs
Diffstat (limited to 'src/string.h')
-rw-r--r--src/string.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/string.h b/src/string.h
index 13a433a..2259582 100644
--- a/src/string.h
+++ b/src/string.h
@@ -33,6 +33,9 @@ strng_t * strng_dup(smrt_arena_t *arena, strng_t const *src);
char *strng_malloc_str(strng_t const *string);
+// Applies F to each char in string and updates the value
+void strng_map(strng_t *string, char (F)(char c));
+
#define STRNG_TO(s) (char *)((u8*)(s)+STRNG_BASE_POS)
#define STRNG_FMT(s) (i32)s->len, (char *)((u8*)(s)+STRNG_BASE_POS)
@@ -99,6 +102,10 @@ void sv_trim_end_nextc(strng_view_t *sv, char n);
// Does nothing if there is no prev char n
void sv_trim_strt_prvc(strng_view_t *sv, char n);
+// Goes backwards from end until character n (skipping n `skip` times)
+// and returns the distance from end
+u64 sv_find_from_end_c(strng_view_t const *sv, char n, u64 skip);
+
// Sets length keeping start
void sv_set_len_left (strng_view_t *sv, u64 n);
// Sets length keeping end