1INDEX(3)                   Linux Programmer's Manual                  INDEX(3)
2
3
4

NAME

6       index, rindex - locate character in string
7

SYNOPSIS

9       #include <strings.h>
10
11       char *index(const char *s, int c);
12
13       char *rindex(const char *s, int c);
14

DESCRIPTION

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  byte  ('\0')  is considered to be a part of the
23       strings.
24

RETURN VALUE

26       The index() and rindex() functions return  a  pointer  to  the  matched
27       character or NULL if the character is not found.
28

ATTRIBUTES

30       For   an   explanation   of   the  terms  used  in  this  section,  see
31       attributes(7).
32
33       ┌──────────────────┬───────────────┬─────────┐
34Interface         Attribute     Value   
35       ├──────────────────┼───────────────┼─────────┤
36index(), rindex() │ Thread safety │ MT-Safe │
37       └──────────────────┴───────────────┴─────────┘

CONFORMING TO

39       4.3BSD; marked as LEGACY in  POSIX.1-2001.   POSIX.1-2008  removes  the
40       specifications of index() and rindex(), recommending strchr(3) and str‐
41       rchr(3) instead.
42

SEE ALSO

44       memchr(3), strchr(3),  string(3),  strpbrk(3),  strrchr(3),  strsep(3),
45       strspn(3), strstr(3), strtok(3)
46

COLOPHON

48       This  page  is  part of release 5.04 of the Linux man-pages project.  A
49       description of the project, information about reporting bugs,  and  the
50       latest     version     of     this    page,    can    be    found    at
51       https://www.kernel.org/doc/man-pages/.
52
53
54
55GNU                               2019-03-06                          INDEX(3)
Impressum