summaryrefslogtreecommitdiff
path: root/src/wchar/wcscspn.c
blob: 1c4f5cf2af679450c5cf49af5280177e06060a0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <wchar.h>
#include "../_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)
*/