xref: /original-bsd/lib/libc/string/index.3 (revision e59fb703)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\" %sccs.include.redist.man%
7.\"
8.\"     @(#)index.3	5.3 (Berkeley) 04/19/91
9.\"
10.Dd
11.Dt INDEX 3
12.Os
13.Sh NAME
14.Nm index
15.Nd locate character in string
16.Sh SYNOPSIS
17.Fd #include <string.h>
18.Ft char *
19.Fn index "const char *s" "int c"
20.Sh DESCRIPTION
21The
22.Fn index
23function
24locates the first character matching
25.Fa c
26(converted to a
27.Em char )
28in the null-terminated string
29.Fa s .
30.Sh RETURN VALUES
31The character
32.Fa c
33is returned if it is found; otherwise
34.Dv NULL
35is returned.
36If
37.Fa c
38is '\e0',
39.Fn index
40locates the terminating '\e0'.
41.Sh SEE ALSO
42.Xr memchr 3 ,
43.Xr rindex 3 ,
44.Xr strchr 3 ,
45.Xr strcspn 3 ,
46.Xr strpbrk 3 ,
47.Xr strrchr 3 ,
48.Xr strsep 3 ,
49.Xr strspn 3 ,
50.Xr strstr 3 ,
51.Xr strtok 3
52.Sh HISTORY
53A
54.Fn index
55function appeared in
56.At v6 .
57