summaryrefslogtreecommitdiff
path: root/src/strutil.h
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-12 16:39:22 +0100
committerLinnnus <[email protected]>2024-02-12 16:39:22 +0100
commit22f2b6a44d670039c7dca399e665ad115bd8436d (patch)
tree2b79850a87331581f295c4664839969eeb722d92 /src/strutil.h
parentaa2edcdf68676c3839593309af97b335cb8388b8 (diff)
feat: Change suffixes when converting
Diffstat (limited to 'src/strutil.h')
-rw-r--r--src/strutil.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/strutil.h b/src/strutil.h
index 03f8294..f00acb3 100644
--- a/src/strutil.h
+++ b/src/strutil.h
@@ -23,4 +23,13 @@ char *joinpath(struct arena *a, const char *path_a, const char *path_b);
// Returns boolean indicating if `haystack` ends with `needle`.
bool endswith(const char *haystack, const char *needle);
+// Replaces the last occurence of `suffix` with `with`.
+// Does NOT check that `orig` ends with `suffix`.
+// Result is allocated in arena.
+char *replace_suffix(struct arena *a, const char *orig, const char *suffix, const char *with);
+
+// Replace all occurences of `rep` in `orig` with `with`.
+// Result is allocated in arena.
+char *replace(struct arena *a, const char *orig, const char *rep, const char *with);
+
#endif