summaryrefslogtreecommitdiff
path: root/src/strutil.h
diff options
context:
space:
mode:
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