summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/al/str.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/al/str.h b/include/al/str.h
index a3ddd8e..10f30ea 100644
--- a/include/al/str.h
+++ b/include/al/str.h
@@ -158,6 +158,16 @@ static inline u32 al_str_find_str(str *s, str *c)
return AL_STR_NPOS;
}
+static inline bool al_str_tok(str *result, char delim)
+{
+ u32 index = al_str_find(result, delim);
+ if (index == AL_STR_NPOS) {
+ return false;
+ }
+ *result = al_str_substr(result, index + 1, result->length);
+ return true;
+}
+
static inline u32 al_str_hash(str *s)
{
u32 hash = 5381;