svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
strrchr(3c)
strchr(3C) Standard C Library Functions strchr(3C)
NAME
strchr, strrchr, strchrnul, strcspn, strspn, strpbrk, strstr, strnstr,
strcasestr - string search operations
SYNOPSIS
#include <string.h>
char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);
char *strchrnul(const char *s, int c);
size_t strcspn(const char *s1, const char *s2);
size_t strspn(const char *s1, const char *s2);
char *strpbrk(const char *s1, const char *s2);
char *strstr(const char *s1, const char *s2);
char *strnstr(const char *s1, const char *s2, size_t n);
char *strcasestr(const char *s1, const char *s2);
ISO C++
#include <string.h>
const char *strchr(const char *s, int c);
const char *strpbrk(const char *s1, const char *s2);
const char *strrchr(const char *s, int c);
const char *strstr(const char *s1, const char *s2);
#include <cstring>
char *std::strchr(char *s, int c);
char *std::strpbrk(char *s1, const char *s2);
char *std::strrchr(char *s, int c);
char *std::strstr(char *s1, const char *s2);
DESCRIPTION
These functions perform various operations on strings (arrays of char‐
acters), which are given as arguments s, s1, and s2 that point to
strings. Depending on the function, strings may be either terminated by
a null character or consist of a length of n bytes. They are designed
for use with encodings representing each character as a single byte,
and all character counts are measured in individual bytes, even if a
string with multibyte characters is used. They do not check for null
pointers, and programs may crash if passing null or otherwise invalid
pointers to these functions, or specifying sizes larger than the memory
allocation in use for the string. Use of adi(7) may help in detecting
out-of-bounds access or invalid pointer usage in code.
strchr(), strrchr(), strchrnul()
The strchr() function returns a pointer to the first occurrence of c
(converted to a char) in string s, or a null pointer if c does not oc‐
cur in the string.
The strrchr() function returns a pointer to the last occurrence of c
(converted to a char) in string s, or a null pointer if c does not oc‐
cur in the string.
The null character terminating a string is considered to be part of the
string, and a pointer to it will be returned if c is 0.
The strchrnul() function is similar to strchr() except that if c is not
found in s, it returns a pointer to the null byte at the end of s,
rather than NULL.
These functions only work with single byte characters.
strcspn(), strspn()
The strcspn() function returns the length of the initial segment of
string s1 that consists entirely of bytes not from string s2. The str‐
spn() function returns the length of the initial segment of string s1
that consists entirely of bytes from string s2.
strpbrk()
The strpbrk() function returns a pointer to the first occurrence in
string s1 of any byte from string s2, or a null pointer if no byte from
s2 exists in s1.
strstr(), strnstr(), strcasestr()
The strstr() function locates the first occurrence of the string s2
(excluding the terminating null character) in string s1 and returns a
pointer to the located string, or a null pointer if the string is not
found. If s2 points to a string with zero length (that is, the string
""), the function returns s1.
The strnstr() function locates the first occurrence of the null-termi‐
nated string s2 in the string s1, where not more than n bytes are
searched. Characters that appear after a '\0' character are not
searched.
The strcasestr() function is similar to strstr(), but ignores differ‐
ences in case when comparing lowercase and uppercase characters, using
the current locale of the process to determine the case of the charac‐
ters.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelAsync-Signal-
Safe _ StandardSee below
Standard
See standards(7) for descriptions of the following standards:
tab() box; cw(2.44i) |cw(3.06i) lw(2.44i) |lw(3.06i) INTERFACESAPPLICA‐
BLE STANDARDS _ T{ strchr(), strcspn(), strpbrk(), strrchr(), strspn(),
strstr() T}T{
C89 through C11,
POSIX.1-1990 through 2008,
SUS through SUSv4,
XPG1 through XPG7
T} _ T{ strcasestr(), strchrnul(), strnstr() T}None
SEE ALSO
memchr(3C), setlocale(3C), string(3C), strtok(3C), wcschr(3C), wmem‐
chr(3C), attributes(7), standards(7)
HISTORY
The strcasestr(), strchrnul(), and strnstr() functions were added to
Oracle Solaris in the Solaris 11.0.0 release.
The strchr(), strcspn(), strpbrk(), strrchr(), strspn(), and strstr()
functions have been included in all Sun and Oracle releases of Solaris.
Oracle Solaris 11.4 28 Feb 2022 strchr(3C)