Debian Codegraph @

upstream/mageia-cauldron/man3/strspn.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH strspn 3 2026-02-08 "Linux man-pages 6.17"
8 .SH NAME
9 strspn, strcspn \- get length of a prefix substring
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <string.h>
16 .P
17 .BI "size_t strspn(const char *" s ", const char *" accept );
18 .BI "size_t strcspn(const char *" s ", const char *" reject );
19 .fi
20 .SH DESCRIPTION
21 The
22 .BR strspn ()
23 function calculates the length (in bytes) of the initial
24 segment of
25 .I s
26 which consists entirely of bytes in
27 .IR accept .
28 .P
29 The
30 .BR strcspn ()
31 function calculates the length of the initial
32 segment of
33 .I s
34 which consists entirely of bytes not in
35 .IR reject .
36 .SH RETURN VALUE
37 The
38 .BR strspn ()
39 function returns the number of bytes in
40 the initial segment of
41 .I s
42 which consist only of bytes
43 from
44 .IR accept .
45 .P
46 The
47 .BR strcspn ()
48 function returns the number of bytes in
49 the initial segment of
50 .I s
51 which are not in the string
52 .IR reject .
53 .SH ATTRIBUTES
54 For an explanation of the terms used in this section, see
55 .BR attributes (7).
56 .TS
57 allbox;
58 lbx lb lb
59 l l l.
60 Interface Attribute Value
61 T{
62 .na
63 .nh
64 .BR strspn (),
65 .BR strcspn ()
66 T} Thread safety MT-Safe
67 .TE
68 .SH STANDARDS
69 C11, POSIX.1-2008.
70 .SH HISTORY
71 POSIX.1-2001, C89, SVr4, 4.3BSD.
72 .SH SEE ALSO
73 .BR memchr (3),
74 .BR strchr (3),
75 .BR string (3),
76 .BR strpbrk (3),
77 .BR strsep (3),
78 .BR strstr (3),
79 .BR strtok (3),
80 .BR wcscspn (3),
81 .BR wcsspn (3)