Add string_pbrk

This commit is contained in:
Patrick Pelissier committed 2017-08-02 22:24:12 +02:00
1 parent 7165740af3
commit a780a7d144
2 files changed
+14

No files matched your search

+9
View File
@@ -436,6 +436,15 @@ string_cspn(const string_t v1, const char accept[])
return strcspn(string_get_cstr(v1), accept);
}
static inline size_t
string_pbrk(const string_t v1, const char first_of[])
{
STRING_CONTRACT (v1);
M_ASSUME (first_of != NULL);
const char *p = M_ASSIGN_CAST(const char*, strpbrk(string_get_cstr(v1), first_of));
return p == NULL ? STRING_FAILURE : (size_t) (p-string_get_cstr(v1));
}
static inline void
string_left(string_t v, size_t index)
{