1strspn(3)                  Library Functions Manual                  strspn(3)
2
3
4

NAME

6       strspn, strcspn - get length of a prefix substring
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <string.h>
13
14       size_t strspn(const char *s, const char *accept);
15       size_t strcspn(const char *s, const char *reject);
16

DESCRIPTION

18       The  strspn()  function calculates the length (in bytes) of the initial
19       segment of s which consists entirely of bytes in accept.
20
21       The strcspn() function calculates the length of the initial segment  of
22       s which consists entirely of bytes not in reject.
23

RETURN VALUE

25       The  strspn()  function returns the number of bytes in the initial seg‐
26       ment of s which consist only of bytes from accept.
27
28       The strcspn() function returns the number of bytes in the initial  seg‐
29       ment of s which are not in the string reject.
30

ATTRIBUTES

32       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
33       tributes(7).
34
35       ┌────────────────────────────────────────────┬───────────────┬─────────┐
36Interface                                   Attribute     Value   
37       ├────────────────────────────────────────────┼───────────────┼─────────┤
38strspn(), strcspn()                         │ Thread safety │ MT-Safe │
39       └────────────────────────────────────────────┴───────────────┴─────────┘
40

STANDARDS

42       C11, POSIX.1-2008.
43

HISTORY

45       POSIX.1-2001, C89, SVr4, 4.3BSD.
46

SEE ALSO

48       memchr(3),  strchr(3),  string(3),  strpbrk(3),  strsep(3),  strstr(3),
49       strtok(3), wcscspn(3), wcsspn(3)
50
51
52
53Linux man-pages 6.05              2023-07-20                         strspn(3)
Impressum