1STRCHR(3)                  Linux Programmer's Manual                 STRCHR(3)
2
3
4

NAME

6       strchr, strrchr, strchrnul - locate character in string
7

SYNOPSIS

9       #include <string.h>
10
11       char *strchr(const char *s, int c);
12
13       char *strrchr(const char *s, int c);
14
15       #define _GNU_SOURCE
16       #include <string.h>
17
18       char *strchrnul(const char *s, int c);
19

DESCRIPTION

21       The  strchr() function returns a pointer to the first occurrence of the
22       character c in the string s.
23
24       The strrchr() function returns a pointer to the last occurrence of  the
25       character c in the string s.
26
27       The strchrnul() function is like strchr() except that if c is not found
28       in s, then it returns a pointer to the null  byte  at  the  end  of  s,
29       rather than NULL.
30
31       Here "character" means "byte"; these functions do not work with wide or
32       multi-byte characters.
33

RETURN VALUE

35       The strchr() and strrchr() functions return a pointer  to  the  matched
36       character or NULL if the character is not found.
37
38       The strchrnul() function returns a pointer to the matched character, or
39       a pointer to the null byte at the end of s (i.e., s+strlen(s))  if  the
40       character is not found.
41

CONFORMING TO

43       strchr() and strrchr() are in SVr4, 4.3BSD, C89, C99.  strchrnul() is a
44       GNU extension.
45

SEE ALSO

47       index(3), memchr(3), rindex(3), strlen(3), strpbrk(3), strsep(3),  str‐
48       spn(3),    strstr(3),    strtok(3),    wcschr(3),    wcsrchr(3),   fea‐
49       ture_test_macros(7)
50
51
52
53GNU                               2006-05-19                         STRCHR(3)
Impressum