1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\" Modified Sun Jul 25 10:54:31 1993, Rik Faith (faith@cs.unc.edu)
30 .TH STRING 3 2019-03-06 "" "Linux Programmer's Manual"
32 stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
33 strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
34 strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
37 .B #include <strings.h>
39 .BI "int strcasecmp(const char *" s1 ", const char *" s2 );
46 .BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
55 .BI "char *index(const char *" s ", int " c );
56 Return a pointer to the first occurrence of the character
61 .BI "char *rindex(const char *" s ", int " c );
62 Return a pointer to the last occurrence of the character
67 .B #include <string.h>
69 .BI "char *stpcpy(char *" dest ", const char *" src );
74 returning a pointer to the end of the resulting string at
77 .BI "char *strcat(char *" dest ", const char *" src );
85 .BI "char *strchr(const char *" s ", int " c );
86 Return a pointer to the first occurrence of the character
91 .BI "int strcmp(const char *" s1 ", const char *" s2 );
97 .BI "int strcoll(const char *" s1 ", const char *" s2 );
102 using the current locale.
104 .BI "char *strcpy(char *" dest ", const char *" src );
109 returning a pointer to the start of
112 .BI "size_t strcspn(const char *" s ", const char *" reject );
113 Calculate the length of the initial segment of the string
115 which does not contain any of bytes in the string
118 .BI "char *strdup(const char *" s );
119 Return a duplicate of the string
121 in memory allocated using
124 .BI "char *strfry(char *" string );
125 Randomly swap the characters in
128 .BI "size_t strlen(const char *" s );
129 Return the length of the string
132 .BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
135 bytes from the string
139 returning a pointer to
142 .BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
150 .BI "char *strncpy(char *" dest ", const char *" src ", size_t " n );
157 returning a pointer to the start of
160 .BI "char *strpbrk(const char *" s ", const char *" accept );
161 Return a pointer to the first occurrence in the string
163 of one of the bytes in the string
166 .BI "char *strrchr(const char *" s ", int " c );
167 Return a pointer to the last occurrence of the character
172 .BI "char *strsep(char **" stringp ", const char *" delim );
173 Extract the initial token in
175 that is delimited by one of the bytes in
178 .BI "size_t strspn(const char *" s ", const char *" accept );
179 Calculate the length of the starting segment in the string
181 that consists entirely of bytes in
184 .BI "char *strstr(const char *" haystack ", const char *" needle );
185 Find the first occurrence of the substring
189 returning a pointer to the found substring.
191 .BI "char *strtok(char *" s ", const char *" delim );
192 Extract tokens from the string
194 that are delimited by one of the bytes in
197 .BI "size_t strxfrm(char *" dest ", const char *" src ", size_t " n );
200 to the current locale and copies the first
205 The string functions perform operations on null-terminated
207 See the individual man pages for descriptions of each function.