diff options
Diffstat (limited to 'src/wchar/wcscspn.c')
| -rw-r--r-- | src/wchar/wcscspn.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wchar/wcscspn.c b/src/wchar/wcscspn.c new file mode 100644 index 00000000..0c300a4a --- /dev/null +++ b/src/wchar/wcscspn.c @@ -0,0 +1,21 @@ +#include <wchar.h> +#include "nonstd/assert.h" + +size_t wcscspn(const wchar_t * s1, const wchar_t * s2) +{ + size_t i; + + ASSERT_NONNULL(s1); + ASSERT_NONNULL(s2); + + for (i = 0; s1[i] != L'\0'; i++) { + if (s1[i] == L'\0' || wcschr(s2, s1[i]) == NULL) { + return i; + } + } + return 0; +} + +/* +STDC(199409) +*/ |
