mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-23 11:28:42 +08:00
bstr: add bstrspn()
This commit is contained in:
@@ -82,6 +82,15 @@ int bstrcspn(struct bstr str, const char *reject)
|
||||
return i;
|
||||
}
|
||||
|
||||
int bstrspn(struct bstr str, const char *accept)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < str.len; i++)
|
||||
if (!strchr(accept, str.start[i]))
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
|
||||
int bstr_find(struct bstr haystack, struct bstr needle)
|
||||
{
|
||||
for (int i = 0; i < haystack.len; i++)
|
||||
|
||||
@@ -58,6 +58,7 @@ int bstrcmp(struct bstr str1, struct bstr str2);
|
||||
int bstrcasecmp(struct bstr str1, struct bstr str2);
|
||||
int bstrchr(struct bstr str, int c);
|
||||
int bstrrchr(struct bstr str, int c);
|
||||
int bstrspn(struct bstr str, const char *accept);
|
||||
int bstrcspn(struct bstr str, const char *reject);
|
||||
|
||||
int bstr_find(struct bstr haystack, struct bstr needle);
|
||||
|
||||
Reference in New Issue
Block a user