]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/string.3
Expanded tabs
[thirdparty/man-pages.git] / man3 / string.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
29.\" Modified Sun Jul 25 10:54:31 1993, Rik Faith (faith@cs.unc.edu)
dd827c27 30.TH STRING 3 2014-01-04 "" "Linux Programmer's Manual"
fea681da 31.SH NAME
513785e2 32stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
fea681da
MK
33strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
34strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
35\- string operations
36.SH SYNOPSIS
fea681da 37.B #include <strings.h>
0612e12e 38.TP
fea681da 39.BI "int strcasecmp(const char *" s1 ", const char *" s2 );
dd827c27 40Compare the strings
0612e12e
MMS
41.I s1
42and
43.I s2
dd827c27 44ignoring case.
0612e12e 45.TP
fea681da 46.BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
dd827c27 47Compare the first
0612e12e 48.I n
dd827c27 49characters of the strings
0612e12e
MMS
50.I s1
51and
52.I s2
dd827c27 53ignoring case.
0612e12e 54.TP
fea681da 55.BI "char *index(const char *" s ", int " c );
dd827c27 56Return a pointer to the first occurrence of the character
0612e12e 57.I c
dd827c27 58in the string
0612e12e
MMS
59.IR s .
60.TP
fea681da 61.BI "char *rindex(const char *" s ", int " c );
dd827c27 62Return a pointer to the last occurrence of the character
0612e12e 63.I c
dd827c27 64in the string
0612e12e
MMS
65.IR s .
66.TP
fea681da 67.B #include <string.h>
0612e12e
MMS
68.TP
69.TP
513785e2 70.BI "char *stpcpy(char *" dest ", const char *" src );
0612e12e
MMS
71Copy a string from
72.I src
73to
dd827c27
MK
74.IR dest ,
75returning a pointer to the end of the resulting string at
0612e12e
MMS
76.IR dest .
77.TP
fea681da 78.BI "char *strcat(char *" dest ", const char *" src );
dd827c27 79Append the string
0612e12e 80.I src
dd827c27
MK
81to the string
82.IR dest ,
83returning a pointer
0612e12e
MMS
84.IR dest .
85.TP
fea681da 86.BI "char *strchr(const char *" s ", int " c );
dd827c27 87Return a pointer to the first occurrence of the character
0612e12e 88.I c
dd827c27 89in the string
0612e12e
MMS
90.IR s .
91.TP
fea681da 92.BI "int strcmp(const char *" s1 ", const char *" s2 );
dd827c27 93Compare the strings
0612e12e
MMS
94.I s1
95with
dd827c27 96.IR s2 .
0612e12e 97.TP
fea681da 98.BI "int strcoll(const char *" s1 ", const char *" s2 );
dd827c27 99Compare the strings
0612e12e
MMS
100.I s1
101with
102.I s2
103using the current locale.
104.TP
fea681da 105.BI "char *strcpy(char *" dest ", const char *" src );
dd827c27 106Copy the string
0612e12e
MMS
107.I src
108to
dd827c27
MK
109.IR dest ,
110returning a pointer to the start of
111.IR dest .
0612e12e 112.TP
fea681da 113.BI "size_t strcspn(const char *" s ", const char *" reject );
dd827c27 114Calculate the length of the initial segment of the string
0612e12e 115.I s
dd827c27
MK
116which does not contain any of bytes in the string
117.IR reject ,
0612e12e 118.TP
fea681da 119.BI "char *strdup(const char *" s );
dd827c27 120Return a duplicate of the string
0612e12e 121.I s
dd827c27 122in memory allocated using
0612e12e
MMS
123.IR malloc (3).
124.TP
fea681da 125.BI "char *strfry(char *" string );
0612e12e 126Randomly swap the characters in
dd827c27 127.IR string .
0612e12e 128.TP
fea681da 129.BI "size_t strlen(const char *" s );
dd827c27 130Return the length of the string
0612e12e
MMS
131.IR s .
132.TP
fea681da 133.BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
dd827c27 134Append at most
0612e12e 135.I n
dd827c27 136characters from the string
0612e12e 137.I src
dd827c27
MK
138to the string
139.IR dest ,
140returning a pointer to
0612e12e
MMS
141.IR dest .
142.TP
fea681da 143.BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
0612e12e
MMS
144Compare at most
145.I n
dd827c27 146bytes of the strings
0612e12e
MMS
147.I s1
148and
149.IR s2.
150.TP
fea681da 151.BI "char *strncpy(char *" dest ", const char *" src ", size_t " n );
0612e12e
MMS
152Copy at most
153.I n
dd827c27 154bytes from string
0612e12e
MMS
155.I src
156to
dd827c27
MK
157.IR dest ,
158returning a pointer to the start of
159.IR dest .
0612e12e 160.TP
fea681da 161.BI "char *strpbrk(const char *" s ", const char *" accept );
dd827c27 162Return a pointer to the first occurrence in the string
0612e12e 163.I s
dd827c27 164of one of the bytes in the string
0612e12e
MMS
165.IR accept .
166.TP
fea681da 167.BI "char *strrchr(const char *" s ", int " c );
dd827c27
MK
168Return a pointer to the last occurrence of the character
169.I c
170in the string
171.IR s .
0612e12e 172.TP
fea681da 173.BI "char *strsep(char **" stringp ", const char *" delim );
dd827c27 174Extract the initial token in
0612e12e 175.I stringp
dd827c27 176that is delimited by one of the bytes in
0612e12e
MMS
177.IR delim .
178.TP
fea681da 179.BI "size_t strspn(const char *" s ", const char *" accept );
dd827c27 180Calculate the length of the starting segment in the string
0612e12e 181.I s
dd827c27 182that consists entirely of bytes in
0612e12e
MMS
183.IR accept .
184.TP
fea681da 185.BI "char *strstr(const char *" haystack ", const char *" needle );
dd827c27 186Find the first occurrence of the substring
0612e12e 187.I needle
dd827c27
MK
188in the string
189.IR haystack ,
190returning a pointer to the found substring.
0612e12e 191.TP
fea681da 192.BI "char *strtok(char *" s ", const char *" delim );
dd827c27 193Extract tokens from the string
0612e12e 194.I s
dd827c27 195that are delimited by one of the bytes in
0612e12e
MMS
196.IR delim .
197.TP
fea681da 198.BI "size_t strxfrm(char *" dest ", const char *" src ", size_t " n );
0612e12e
MMS
199Transforms
200.I src
201to the current locale and copies the first
202.I n
203characters to
204.IR dest .
fea681da
MK
205.fi
206.SH DESCRIPTION
28d88c17 207The string functions perform string operations on null-terminated
c13182ef
MK
208strings.
209See the individual man pages for descriptions of each function.
47297adb 210.SH SEE ALSO
fea681da
MK
211.BR index (3),
212.BR rindex (3),
513785e2 213.BR stpcpy (3),
3e5c319e 214.BR strcasecmp (3),
fea681da
MK
215.BR strcat (3),
216.BR strchr (3),
217.BR strcmp (3),
218.BR strcoll (3),
219.BR strcpy (3),
220.BR strcspn (3),
221.BR strdup (3),
222.BR strfry (3),
223.BR strlen (3),
224.BR strncasecmp (3),
225.BR strncat (3),
226.BR strncmp (3),
227.BR strncpy (3),
228.BR strpbrk (3),
229.BR strrchr (3),
230.BR strsep (3),
231.BR strspn (3),
232.BR strstr (3),
233.BR strtok (3),
234.BR strxfrm (3)