1STRING(3) Linux Programmer's Manual STRING(3)
2
3
4
6 stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
7 strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strp‐
8 brk, strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex -
9 string operations
10
12 #include <strings.h>
13
14 int strcasecmp(const char *s1, const char *s2);
15 Compare the strings s1 and s2 ignoring case.
16
17 int strncasecmp(const char *s1, const char *s2, size_t n);
18 Compare the first n characters of the strings s1 and s2 ignoring
19 case.
20
21 char *index(const char *s, int c);
22 Return a pointer to the first occurrence of the character c in
23 the string s.
24
25 char *rindex(const char *s, int c);
26 Return a pointer to the last occurrence of the character c in
27 the string s.
28
29 #include <string.h>
30
31 char *stpcpy(char *dest, const char *src);
32 Copy a string from src to dest, returning a pointer to the end
33 of the resulting string at dest.
34
35 char *strcat(char *dest, const char *src);
36 Append the string src to the string dest, returning a pointer
37 dest.
38
39 char *strchr(const char *s, int c);
40 Return a pointer to the first occurrence of the character c in
41 the string s.
42
43 int strcmp(const char *s1, const char *s2);
44 Compare the strings s1 with s2.
45
46 int strcoll(const char *s1, const char *s2);
47 Compare the strings s1 with s2 using the current locale.
48
49 char *strcpy(char *dest, const char *src);
50 Copy the string src to dest, returning a pointer to the start of
51 dest.
52
53 size_t strcspn(const char *s, const char *reject);
54 Calculate the length of the initial segment of the string s
55 which does not contain any of bytes in the string reject,
56
57 char *strdup(const char *s);
58 Return a duplicate of the string s in memory allocated using
59 malloc(3).
60
61 char *strfry(char *string);
62 Randomly swap the characters in string.
63
64 size_t strlen(const char *s);
65 Return the length of the string s.
66
67 char *strncat(char *dest, const char *src, size_t n);
68 Append at most n characters from the string src to the string
69 dest, returning a pointer to dest.
70
71 int strncmp(const char *s1, const char *s2, size_t n);
72 Compare at most n bytes of the strings s1 and s2.
73
74 char *strncpy(char *dest, const char *src, size_t n);
75 Copy at most n bytes from string src to dest, returning a
76 pointer to the start of dest.
77
78 char *strpbrk(const char *s, const char *accept);
79 Return a pointer to the first occurrence in the string s of one
80 of the bytes in the string accept.
81
82 char *strrchr(const char *s, int c);
83 Return a pointer to the last occurrence of the character c in
84 the string s.
85
86 char *strsep(char **stringp, const char *delim);
87 Extract the initial token in stringp that is delimited by one of
88 the bytes in delim.
89
90 size_t strspn(const char *s, const char *accept);
91 Calculate the length of the starting segment in the string s
92 that consists entirely of bytes in accept.
93
94 char *strstr(const char *haystack, const char *needle);
95 Find the first occurrence of the substring needle in the string
96 haystack, returning a pointer to the found substring.
97
98 char *strtok(char *s, const char *delim);
99 Extract tokens from the string s that are delimited by one of
100 the bytes in delim.
101
102 size_t strxfrm(char *dest, const char *src, size_t n);
103 Transforms src to the current locale and copies the first n
104 characters to dest.
105
107 The string functions perform operations on null-terminated strings.
108 See the individual man pages for descriptions of each function.
109
111 index(3), rindex(3), stpcpy(3), strcasecmp(3), strcat(3), strchr(3),
112 strcmp(3), strcoll(3), strcpy(3), strcspn(3), strdup(3), strfry(3),
113 strlen(3), strncasecmp(3), strncat(3), strncmp(3), strncpy(3), strp‐
114 brk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3),
115 strxfrm(3)
116
118 This page is part of release 4.15 of the Linux man-pages project. A
119 description of the project, information about reporting bugs, and the
120 latest version of this page, can be found at
121 https://www.kernel.org/doc/man-pages/.
122
123
124
125 2014-01-04 STRING(3)