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