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 2021-03-22 "" "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 *restrict " dest ", const char *restrict " src );
74 returning a pointer to the end of the resulting string at
77 .BI "char *strcat(char *restrict " dest ", const char *restrict " 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 *restrict " dest ", const char *restrict " 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 *restrict " dest ", const char *restrict " src \
136 bytes from the string
140 returning a pointer to
143 .BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
151 .BI "char *strncpy(char *restrict " dest ", const char *restrict " src \
159 returning a pointer to the start of
162 .BI "char *strpbrk(const char *" s ", const char *" accept );
163 Return a pointer to the first occurrence in the string
165 of one of the bytes in the string
168 .BI "char *strrchr(const char *" s ", int " c );
169 Return a pointer to the last occurrence of the character
174 .BI "char *strsep(char **restrict " stringp ", const char *restrict " delim );
175 Extract the initial token in
177 that is delimited by one of the bytes in
180 .BI "size_t strspn(const char *" s ", const char *" accept );
181 Calculate the length of the starting segment in the string
183 that consists entirely of bytes in
186 .BI "char *strstr(const char *" haystack ", const char *" needle );
187 Find the first occurrence of the substring
191 returning a pointer to the found substring.
193 .BI "char *strtok(char *restrict " s ", const char *restrict " delim );
194 Extract tokens from the string
196 that are delimited by one of the bytes in
199 .BI "size_t strxfrm(char *restrict " dst ", const char *restrict " src \
203 to the current locale and copies the first
208 The string functions perform operations on null-terminated
210 See the individual man pages for descriptions of each function.