summaryrefslogtreecommitdiff
path: root/src/string/strspn.c
blob: 9762d953c85dc9ed56bd6ab993d8f9bf18fabaca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if 0

#include <string.h>
#include "_assert.h"

/** count matching characters **/

size_t strspn(const char *s1, const char *s2)
{
	size_t i = 0;

	ASSERT_NONNULL(s1);
	ASSERT_NONNULL(s2);

	for (i = 0; i < strlen (s1); i++) {
		if (strchr(s2, s1[i]) == NULL) {
			break;
		}
	}

	return i;
}

/***
computes the length of the maximum initial segment of the ARGUMENT(s1) made
up of characters from ARGUMENT(s2).
***/

/*
RETURN_ALWAYS(the number of matching characters);
STDC(1)
*/


#endif