]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/string.3
fuse.4: ffix
[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
51d8bd57 49bytes of the strings
0612e12e 50.I s1
d3532647
MK
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
d3532647 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 68.TP
513785e2 69.BI "char *stpcpy(char *" dest ", const char *" src );
0612e12e
MMS
70Copy a string from
71.I src
72to
dd827c27
MK
73.IR dest ,
74returning a pointer to the end of the resulting string at
0612e12e
MMS
75.IR dest .
76.TP
fea681da 77.BI "char *strcat(char *" dest ", const char *" src );
dd827c27 78Append the string
0612e12e 79.I src
dd827c27
MK
80to the string
81.IR dest ,
82returning a pointer
0612e12e
MMS
83.IR dest .
84.TP
fea681da 85.BI "char *strchr(const char *" s ", int " c );
dd827c27 86Return a pointer to the first occurrence of the character
0612e12e 87.I c
dd827c27 88in the string
0612e12e
MMS
89.IR s .
90.TP
fea681da 91.BI "int strcmp(const char *" s1 ", const char *" s2 );
dd827c27 92Compare the strings
0612e12e
MMS
93.I s1
94with
dd827c27 95.IR s2 .
0612e12e 96.TP
fea681da 97.BI "int strcoll(const char *" s1 ", const char *" s2 );
dd827c27 98Compare the strings
0612e12e
MMS
99.I s1
100with
101.I s2
102using the current locale.
103.TP
fea681da 104.BI "char *strcpy(char *" dest ", const char *" src );
dd827c27 105Copy the string
0612e12e
MMS
106.I src
107to
dd827c27
MK
108.IR dest ,
109returning a pointer to the start of
110.IR dest .
0612e12e 111.TP
fea681da 112.BI "size_t strcspn(const char *" s ", const char *" reject );
dd827c27 113Calculate the length of the initial segment of the string
0612e12e 114.I s
dd827c27
MK
115which does not contain any of bytes in the string
116.IR reject ,
0612e12e 117.TP
fea681da 118.BI "char *strdup(const char *" s );
dd827c27 119Return a duplicate of the string
0612e12e 120.I s
dd827c27 121in memory allocated using
d067764a 122.BR malloc (3).
0612e12e 123.TP
fea681da 124.BI "char *strfry(char *" string );
0612e12e 125Randomly swap the characters in
dd827c27 126.IR string .
0612e12e 127.TP
fea681da 128.BI "size_t strlen(const char *" s );
dd827c27 129Return the length of the string
0612e12e
MMS
130.IR s .
131.TP
fea681da 132.BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
dd827c27 133Append at most
0612e12e 134.I n
51d8bd57 135bytes from the string
0612e12e 136.I src
dd827c27
MK
137to the string
138.IR dest ,
139returning a pointer to
0612e12e
MMS
140.IR dest .
141.TP
fea681da 142.BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
0612e12e
MMS
143Compare at most
144.I n
dd827c27 145bytes of the strings
0612e12e
MMS
146.I s1
147and
c367cd59 148.IR s2 .
0612e12e 149.TP
fea681da 150.BI "char *strncpy(char *" dest ", const char *" src ", size_t " n );
0612e12e
MMS
151Copy at most
152.I n
dd827c27 153bytes from string
0612e12e
MMS
154.I src
155to
dd827c27
MK
156.IR dest ,
157returning a pointer to the start of
158.IR dest .
0612e12e 159.TP
fea681da 160.BI "char *strpbrk(const char *" s ", const char *" accept );
dd827c27 161Return a pointer to the first occurrence in the string
0612e12e 162.I s
dd827c27 163of one of the bytes in the string
0612e12e
MMS
164.IR accept .
165.TP
fea681da 166.BI "char *strrchr(const char *" s ", int " c );
dd827c27
MK
167Return a pointer to the last occurrence of the character
168.I c
169in the string
170.IR s .
0612e12e 171.TP
fea681da 172.BI "char *strsep(char **" stringp ", const char *" delim );
dd827c27 173Extract the initial token in
0612e12e 174.I stringp
dd827c27 175that is delimited by one of the bytes in
0612e12e
MMS
176.IR delim .
177.TP
fea681da 178.BI "size_t strspn(const char *" s ", const char *" accept );
dd827c27 179Calculate the length of the starting segment in the string
0612e12e 180.I s
dd827c27 181that consists entirely of bytes in
0612e12e
MMS
182.IR accept .
183.TP
fea681da 184.BI "char *strstr(const char *" haystack ", const char *" needle );
dd827c27 185Find the first occurrence of the substring
0612e12e 186.I needle
dd827c27
MK
187in the string
188.IR haystack ,
189returning a pointer to the found substring.
0612e12e 190.TP
fea681da 191.BI "char *strtok(char *" s ", const char *" delim );
dd827c27 192Extract tokens from the string
0612e12e 193.I s
dd827c27 194that are delimited by one of the bytes in
0612e12e
MMS
195.IR delim .
196.TP
fea681da 197.BI "size_t strxfrm(char *" dest ", const char *" src ", size_t " n );
0612e12e
MMS
198Transforms
199.I src
200to the current locale and copies the first
201.I n
51d8bd57 202bytes to
0612e12e 203.IR dest .
fea681da 204.SH DESCRIPTION
69263796 205The string functions perform operations on null-terminated
c13182ef
MK
206strings.
207See the individual man pages for descriptions of each function.
47297adb 208.SH SEE ALSO
fea681da
MK
209.BR index (3),
210.BR rindex (3),
513785e2 211.BR stpcpy (3),
3e5c319e 212.BR strcasecmp (3),
fea681da
MK
213.BR strcat (3),
214.BR strchr (3),
215.BR strcmp (3),
216.BR strcoll (3),
217.BR strcpy (3),
218.BR strcspn (3),
219.BR strdup (3),
220.BR strfry (3),
221.BR strlen (3),
222.BR strncasecmp (3),
223.BR strncat (3),
224.BR strncmp (3),
225.BR strncpy (3),
226.BR strpbrk (3),
227.BR strrchr (3),
228.BR strsep (3),
229.BR strspn (3),
230.BR strstr (3),
231.BR strtok (3),
232.BR strxfrm (3)