xref: /original-bsd/lib/libc/string/index.3 (revision c3e32dec)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  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	8.1 (Berkeley) 06/04/93
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
31A pointer to the character is returned if it is found; otherwise
32.Dv NULL
33is returned.
34If
35.Fa c
36is '\e0',
37.Fn index
38locates the terminating '\e0'.
39.Sh SEE ALSO
40.Xr memchr 3 ,
41.Xr rindex 3 ,
42.Xr strchr 3 ,
43.Xr strcspn 3 ,
44.Xr strpbrk 3 ,
45.Xr strrchr 3 ,
46.Xr strsep 3 ,
47.Xr strspn 3 ,
48.Xr strstr 3 ,
49.Xr strtok 3
50.Sh HISTORY
51A
52.Fn index
53function appeared in
54.At v6 .
55