1INDEX(3) Linux Programmer's Manual INDEX(3)
2
3
4
6 index, rindex - locate character in string
7
9 #include <strings.h>
10
11 char *index(const char *s, int c);
12
13 char *rindex(const char *s, int c);
14
16 The index() function returns a pointer to the first occurrence of the
17 character c in the string s.
18
19 The rindex() function returns a pointer to the last occurrence of the
20 character c in the string s.
21
22 The terminating NULL character is considered to be a part of the
23 strings.
24
26 The index() and rindex() functions return a pointer to the matched
27 character or NULL if the character is not found.
28
30 4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the
31 specifications of index() and rindex(), recommending strchr(3) and str‐
32 rchr(3) instead.
33
35 memchr(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), strspn(3),
36 strstr(3), strtok(3)
37
39 This page is part of release 3.25 of the Linux man-pages project. A
40 description of the project, and information about reporting bugs, can
41 be found at http://www.kernel.org/doc/man-pages/.
42
43
44
45GNU 2009-03-15 INDEX(3)