From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/string/wcscspn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/string/wcscspn.c (limited to 'src/string/wcscspn.c') diff --git a/src/string/wcscspn.c b/src/string/wcscspn.c new file mode 100644 index 0000000..c4e5272 --- /dev/null +++ b/src/string/wcscspn.c @@ -0,0 +1,10 @@ +#include + +size_t wcscspn(const wchar_t *s, const wchar_t *c) +{ + const wchar_t *a; + if (!c[0]) return wcslen(s); + if (!c[1]) return (s=wcschr(a=s, *c)) ? s-a : wcslen(a); + for (a=s; *s && !wcschr(c, *s); s++); + return s-a; +} -- cgit v1.2.3