1STRING(3) Library Functions Manual STRING(3)
2
3
4
6 strcat, strncat, strcmp, strncmp, strcasecmp, strncasecmp, strcpy,
7 strncpy, strlen, index, rindex - string operations
8
10 #include <strings.h>
11
12 char *strcat(s, append)
13 char *s, *append;
14
15 char *strncat(s, append, count)
16 char *s, *append;
17 int count;
18
19 strcmp(s1, s2)
20 char *s1, *s2;
21
22 strncmp(s1, s2, count)
23 char *s1, *s2;
24 int count;
25
26 strcasecmp(s1, s2)
27 char *s1, *s2;
28
29 strncasecmp(s1, s2, count)
30 char *s1, *s2;
31 int count;
32
33 char *strcpy(to, from)
34 char *to, *from;
35
36 char *strncpy(to, from, count)
37 char *to, *from;
38 int count;
39
40 strlen(s)
41 char *s;
42
43 char *index(s, c)
44 char *s, c;
45
46 char *rindex(s, c)
47 char *s, c;
48
50 These functions operate on null-terminated strings. They do not check
51 for overflow of any receiving string.
52
53 Strcat appends a copy of string append to the end of string s. Strncat
54 copies at most count characters. Both return a pointer to the null-
55 terminated result.
56
57 Strcmp compares its arguments and returns an integer greater than,
58 equal to, or less than 0, according as s1 is lexicographically greater
59 than, equal to, or less than s2. Strncmp makes the same comparison but
60 looks at at most count characters. Strcasecmp and strncasecmp are
61 identical in function, but are case insensitive. The returned lexico‐
62 graphic difference reflects a conversion to lower-case.
63
64 Strcpy copies string from to to, stopping after the null character has
65 been moved. Strncpy copies exactly count characters, appending nulls
66 if from is less than count characters in length; the target may not be
67 null-terminated if the length of from is count or more. Both return
68 to.
69
70 Strlen returns the number of non-null characters in s.
71
72 Index (rindex) returns a pointer to the first (last) occurrence of
73 character c in string s or zero if c does not occur in the string.
74 Setting c to NULL works.
75
76
77
784th Berkeley Distribution October 22, 1987 STRING(3)