]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
28 | .\" 386BSD man pages | |
29 | .\" Modified Mon Apr 12 12:54:34 1993, David Metcalfe | |
30 | .\" Modified Sat Jul 24 19:13:52 1993, Rik Faith (faith@cs.unc.edu) | |
fe0fefbf | 31 | .TH INDEX 3 2015-03-02 "GNU" "Linux Programmer's Manual" |
fea681da MK |
32 | .SH NAME |
33 | index, rindex \- locate character in string | |
34 | .SH SYNOPSIS | |
35 | .nf | |
36 | .B #include <strings.h> | |
68e4db0a | 37 | .PP |
fea681da | 38 | .BI "char *index(const char *" s ", int " c ); |
68e4db0a | 39 | .PP |
fea681da MK |
40 | .BI "char *rindex(const char *" s ", int " c ); |
41 | .fi | |
42 | .SH DESCRIPTION | |
60a90ecd MK |
43 | The |
44 | .BR index () | |
45 | function returns a pointer to the first occurrence | |
fea681da MK |
46 | of the character \fIc\fP in the string \fIs\fP. |
47 | .PP | |
60a90ecd MK |
48 | The |
49 | .BR rindex () | |
50 | function returns a pointer to the last occurrence | |
fea681da MK |
51 | of the character \fIc\fP in the string \fIs\fP. |
52 | .PP | |
098ad132 | 53 | The terminating null byte (\(aq\\0\(aq) is considered to be a part of the |
fea681da | 54 | strings. |
47297adb | 55 | .SH RETURN VALUE |
60a90ecd MK |
56 | The |
57 | .BR index () | |
58 | and | |
59 | .BR rindex () | |
60 | functions return a pointer to | |
fea681da | 61 | the matched character or NULL if the character is not found. |
8cad35ef | 62 | .SH ATTRIBUTES |
52274086 MK |
63 | For an explanation of the terms used in this section, see |
64 | .BR attributes (7). | |
65 | .TS | |
66 | allbox; | |
67 | lb lb lb | |
68 | l l l. | |
69 | Interface Attribute Value | |
70 | T{ | |
71 | .BR index (), | |
8cad35ef | 72 | .BR rindex () |
52274086 MK |
73 | T} Thread safety MT-Safe |
74 | .TE | |
47297adb | 75 | .SH CONFORMING TO |
68e1685c | 76 | 4.3BSD; marked as LEGACY in POSIX.1-2001. |
64e082ef | 77 | POSIX.1-2008 removes the specifications of |
97c8e181 MK |
78 | .BR index () |
79 | and | |
cbf4eee7 MK |
80 | .BR rindex (), |
81 | recommending | |
82 | .BR strchr (3) | |
83 | and | |
84 | .BR strrchr (3) | |
85 | instead. | |
47297adb | 86 | .SH SEE ALSO |
fea681da MK |
87 | .BR memchr (3), |
88 | .BR strchr (3), | |
d095200e | 89 | .BR string (3), |
fea681da MK |
90 | .BR strpbrk (3), |
91 | .BR strrchr (3), | |
92 | .BR strsep (3), | |
93 | .BR strspn (3), | |
94 | .BR strstr (3), | |
95 | .BR strtok (3) |