summaryrefslogtreecommitdiffstats
path: root/bstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'bstr.c')
-rw-r--r--bstr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bstr.c b/bstr.c
index 809b02e665..fcf73ca828 100644
--- a/bstr.c
+++ b/bstr.c
@@ -198,6 +198,14 @@ struct bstr bstr_getline(struct bstr str, struct bstr *rest)
return str;
}
+bool bstr_eatstart(struct bstr *s, struct bstr prefix)
+{
+ if (!bstr_startswith(*s, prefix))
+ return false;
+ *s = bstr_cut(*s, prefix.len);
+ return true;
+}
+
void bstr_lower(struct bstr str)
{
for (int i = 0; i < str.len; i++)