INDEX(3,L) AIX Technical Reference INDEX(3,L)
-------------------------------------------------------------------------------
index, rindex
PURPOSE
Locates a character in a string.
LIBRARY
Standard C Library (libc.a)
SYNTAX
char *index (string, character) char *rindex (string, character)
char *string, character; char *string, character;
DESCRIPTION
The index subroutine returns a pointer to the first occurrence of character in
string, while the rindex subroutine returns a pointer to the last occurrence of
character in string. Both subroutines return a value of 0 if the character
does not occur in the string.
These functions operate on null-terminated strings.
Because the BSD4.3 subroutines index and rindex have been implemented here as
calls to the System V strchr and strrchr subroutines, be prepared for potential
unexpected results if you are porting code using the index and rindex
subroutines described here. See "string" for more information on the strchr
and strrchr subroutines which can be used to perform the same operations.
Note also that the index subroutine described here is different from that
available with Programmer's Workbench Library (libPW.a). If you link from
libPW.a, you cannot use the index subroutine; you must use the strchr
subroutine instead.
RELATED INFORMATION
In this book: "string."
Processed November 7, 1990 INDEX(3,L) 1