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 size_t strcspn(const char *s, const char *reject);
13
15 The strspn() function calculates the length (in bytes) of the initial
16 segment of s which consists entirely of bytes in accept.
17
18 The strcspn() function calculates the length of the initial segment of
19 s which consists entirely of bytes not in reject.
20
22 The strspn() function returns the number of bytes in the initial seg‐
23 ment of s which consist only of bytes from accept.
24
25 The strcspn() function returns the number of bytes in the initial seg‐
26 ment of s which are not in the string reject.
27
29 For an explanation of the terms used in this section, see at‐
30 tributes(7).
31
32 ┌────────────────────────────────────────────┬───────────────┬─────────┐
33 │Interface │ Attribute │ Value │
34 ├────────────────────────────────────────────┼───────────────┼─────────┤
35 │strspn(), strcspn() │ Thread safety │ MT-Safe │
36 └────────────────────────────────────────────┴───────────────┴─────────┘
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.12 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 2021-03-22 STRSPN(3)