add: str_contain_only
This commit is contained in:
parent
651de74c27
commit
13f3bb0730
@ -4,3 +4,5 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
char **split(const char *str, const char *delimiter);
|
||||
|
||||
int str_contain_only(const char *str, const char *charset);
|
||||
|
11
src/str/str_contain_only.c
Normal file
11
src/str/str_contain_only.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "./str.h"
|
||||
|
||||
int str_contain_only(const char *str, const char *charset)
|
||||
{
|
||||
for (size_t i = 0; str[i] != '\0'; i++)
|
||||
{
|
||||
if (strchr(charset, str[i]) == NULL)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user