summaryrefslogtreecommitdiffstats
path: root/man3/index.3
blob: 6fc4a0f17cc09466992a163da4822ebd6e0c7027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\" May be distributed under the GNU General Public License
.\" References consulted:
.\"     Linux libc source code
.\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\"     386BSD man pages
.\" Modified Mon Apr 12 12:54:34 1993, David Metcalfe
.\" Modified Sat Jul 24 19:13:52 1993, Rik Faith (faith@cs.unc.edu)
.TH INDEX 3  "April 12, 1993" "GNU" "Linux Programmer's Manual"
.SH NAME
index, rindex \- locate character in string
.SH SYNOPSIS
.nf
.B #include <string.h>
.sp
.BI "char *index(const char *" s ", int " c );
.sp
.BI "char *rindex(const char *" s ", int " c );
.fi
.SH DESCRIPTION
The \fBindex()\fP function returns a pointer to the first occurrence
of the character \fIc\fP in the string \fIs\fP.
.PP
The \fBrindex()\fP function returns a pointer to the last occurrence
of the character \fIc\fP in the string \fIs\fP.
.PP
The terminating NULL character is considered to be a part of the
strings.
.SH "RETURN VALUE"
The \fBindex()\fP and \fBrindex()\fP functions return a pointer to
the matched character or NULL if the character is not found.
.SH "CONFORMING TO"
BSD 4.3
.SH SEE ALSO
.BR memchr "(3), " strchr "(3), " strpbrk "(3), " strrchr (3),
.BR strsep "(3), " strspn "(3), " strstr "(3), " strtok (3)