mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
bstr: add bstrspn()
This commit is contained in:
parent
465ccd2c93
commit
5bc7e4d6eb
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user