index, rindex - string operations
#include <strings.h> char *index(const char *s, int c);
char *rindex(const char *s, int c);
The index() and rindex() functions operate on null-terminated strings.
The index() function returns a pointer to the first occurrence of character c in string s.
The rindex() function returns a pointer to the last occurrence of character c in string s.
Both index() and rindex() return a null pointer if c does not occur in the string. The null character terminating a string is considered to be part of the string.
These functions are provided for compatibility with older code. The strchr() and strrchr() functions defined by the C standards are more portable and preferred in newly written code.
See attributes(7) for descriptions of the following attributes:
The index() and rindex() functions were added to libc in the Solaris 2.5 release. In Solaris 2 releases prior to 2.5 they were in the libucb library.