1STRSPN(3) Linux Programmer's Manual STRSPN(3)
2
3
4
6 strspn, strcspn - get length of a prefix substring
7
9 #include <string.h>
10
11 size_t strspn(const char *s, const char *accept);
12
13 size_t strcspn(const char *s, const char *reject);
14
16 The strspn() function calculates the length (in bytes) of the initial
17 segment of s which consists entirely of bytes in accept.
18
19 The strcspn() function calculates the length of the initial segment of
20 s which consists entirely of bytes not in reject.
21
23 The strspn() function returns the number of bytes in the initial seg‐
24 ment of s which consist only of bytes from accept.
25
26 The strcspn() function returns the number of bytes in the initial seg‐
27 ment of s which are not in the string reject.
28
30 For an explanation of the terms used in this section, see
31 attributes(7).
32
33 ┌────────────────────┬───────────────┬─────────┐
34 │Interface │ Attribute │ Value │
35 ├────────────────────┼───────────────┼─────────┤
36 │strspn(), strcspn() │ Thread safety │ MT-Safe │
37 └────────────────────┴───────────────┴─────────┘
39 POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD.
40
42 index(3), memchr(3), rindex(3), strchr(3), string(3), strpbrk(3),
43 strsep(3), strstr(3), strtok(3), wcscspn(3), wcsspn(3)
44
46 This page is part of release 5.02 of the Linux man-pages project. A
47 description of the project, information about reporting bugs, and the
48 latest version of this page, can be found at
49 https://www.kernel.org/doc/man-pages/.
50
51
52
53 2015-08-08 STRSPN(3)