]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/string.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / string.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8 .\" 386BSD man pages
9 .\" Modified Sun Jul 25 10:54:31 1993, Rik Faith (faith@cs.unc.edu)
10 .TH STRING 3 2021-03-22 "Linux man-pages (unreleased)"
11 .SH NAME
12 stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
13 strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
14 strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
15 \- string operations
16 .SH LIBRARY
17 Standard C library
18 .RI ( libc ", " \-lc )
19 .SH SYNOPSIS
20 .B #include <strings.h>
21 .TP
22 .BI "int strcasecmp(const char *" s1 ", const char *" s2 );
23 Compare the strings
24 .I s1
25 and
26 .I s2
27 ignoring case.
28 .TP
29 .BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
30 Compare the first
31 .I n
32 bytes of the strings
33 .I s1
34 and
35 .I s2
36 ignoring case.
37 .TP
38 .BI "char *index(const char *" s ", int " c );
39 Return a pointer to the first occurrence of the character
40 .I c
41 in the string
42 .IR s .
43 .TP
44 .BI "char *rindex(const char *" s ", int " c );
45 Return a pointer to the last occurrence of the character
46 .I c
47 in the string
48 .IR s .
49 .TP
50 .B #include <string.h>
51 .TP
52 .BI "char *stpcpy(char *restrict " dest ", const char *restrict " src );
53 Copy a string from
54 .I src
55 to
56 .IR dest ,
57 returning a pointer to the end of the resulting string at
58 .IR dest .
59 .TP
60 .BI "char *strcat(char *restrict " dest ", const char *restrict " src );
61 Append the string
62 .I src
63 to the string
64 .IR dest ,
65 returning a pointer
66 .IR dest .
67 .TP
68 .BI "char *strchr(const char *" s ", int " c );
69 Return a pointer to the first occurrence of the character
70 .I c
71 in the string
72 .IR s .
73 .TP
74 .BI "int strcmp(const char *" s1 ", const char *" s2 );
75 Compare the strings
76 .I s1
77 with
78 .IR s2 .
79 .TP
80 .BI "int strcoll(const char *" s1 ", const char *" s2 );
81 Compare the strings
82 .I s1
83 with
84 .I s2
85 using the current locale.
86 .TP
87 .BI "char *strcpy(char *restrict " dest ", const char *restrict " src );
88 Copy the string
89 .I src
90 to
91 .IR dest ,
92 returning a pointer to the start of
93 .IR dest .
94 .TP
95 .BI "size_t strcspn(const char *" s ", const char *" reject );
96 Calculate the length of the initial segment of the string
97 .I s
98 which does not contain any of bytes in the string
99 .IR reject ,
100 .TP
101 .BI "char *strdup(const char *" s );
102 Return a duplicate of the string
103 .I s
104 in memory allocated using
105 .BR malloc (3).
106 .TP
107 .BI "char *strfry(char *" string );
108 Randomly swap the characters in
109 .IR string .
110 .TP
111 .BI "size_t strlen(const char *" s );
112 Return the length of the string
113 .IR s .
114 .TP
115 .BI "char *strncat(char *restrict " dest ", const char *restrict " src \
116 ", size_t " n );
117 Append at most
118 .I n
119 bytes from the string
120 .I src
121 to the string
122 .IR dest ,
123 returning a pointer to
124 .IR dest .
125 .TP
126 .BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
127 Compare at most
128 .I n
129 bytes of the strings
130 .I s1
131 and
132 .IR s2 .
133 .TP
134 .BI "char *strncpy(char *restrict " dest ", const char *restrict " src \
135 ", size_t " n );
136 Copy at most
137 .I n
138 bytes from string
139 .I src
140 to
141 .IR dest ,
142 returning a pointer to the start of
143 .IR dest .
144 .TP
145 .BI "char *strpbrk(const char *" s ", const char *" accept );
146 Return a pointer to the first occurrence in the string
147 .I s
148 of one of the bytes in the string
149 .IR accept .
150 .TP
151 .BI "char *strrchr(const char *" s ", int " c );
152 Return a pointer to the last occurrence of the character
153 .I c
154 in the string
155 .IR s .
156 .TP
157 .BI "char *strsep(char **restrict " stringp ", const char *restrict " delim );
158 Extract the initial token in
159 .I stringp
160 that is delimited by one of the bytes in
161 .IR delim .
162 .TP
163 .BI "size_t strspn(const char *" s ", const char *" accept );
164 Calculate the length of the starting segment in the string
165 .I s
166 that consists entirely of bytes in
167 .IR accept .
168 .TP
169 .BI "char *strstr(const char *" haystack ", const char *" needle );
170 Find the first occurrence of the substring
171 .I needle
172 in the string
173 .IR haystack ,
174 returning a pointer to the found substring.
175 .TP
176 .BI "char *strtok(char *restrict " s ", const char *restrict " delim );
177 Extract tokens from the string
178 .I s
179 that are delimited by one of the bytes in
180 .IR delim .
181 .TP
182 .BI "size_t strxfrm(char *restrict " dst ", const char *restrict " src \
183 ", size_t " n );
184 Transforms
185 .I src
186 to the current locale and copies the first
187 .I n
188 bytes to
189 .IR dst .
190 .SH DESCRIPTION
191 The string functions perform operations on null-terminated
192 strings.
193 See the individual man pages for descriptions of each function.
194 .SH SEE ALSO
195 .BR bstring (3),
196 .BR index (3),
197 .BR rindex (3),
198 .BR stpcpy (3),
199 .BR strcasecmp (3),
200 .BR strcat (3),
201 .BR strchr (3),
202 .BR strcmp (3),
203 .BR strcoll (3),
204 .BR strcpy (3),
205 .BR strcspn (3),
206 .BR strdup (3),
207 .BR strfry (3),
208 .BR strlen (3),
209 .BR strncasecmp (3),
210 .BR strncat (3),
211 .BR strncmp (3),
212 .BR strncpy (3),
213 .BR strpbrk (3),
214 .BR strrchr (3),
215 .BR strsep (3),
216 .BR strspn (3),
217 .BR strstr (3),
218 .BR strtok (3),
219 .BR strxfrm (3)