Strchr, wcschr, strrchr, wcsrchr, _ tcschr, _ tcsrchr Function
(1)
Char * strchr (const char*String,Int C );Wchar_t*Wcschr (const wchar_t*String,Wchar_t C );Find a character in a string.Searches for the specified character that appears for the first
C strchr function example
Prototype: char * strchr (const char * s, char c );
# Include
Searches for the position where character c appears for the first time in string s, and returns the pointer to the position where character c appears for
Header files: #include STRCHR () is used to find the first occurrence of a character in a string, and its prototype is:char * STRCHR (const char *STR, int c);"Parameter" STR is the string to find, and C is the character to look for.STRCHR () will
Strchrdefined in header file Char *strchr (const char *STR, int ch);look for the first occurrence of CH (converted to char as (char) ch) in the null-terminated byte string pointed to by STR (each character is considered to be a unsigned char). The
PHP strchr () function example tutorial
Definition and usageThis strchr () function searches for a series of other internal strings for the first time.This function returns the remaining strings (from the matching point), or FALSE if this string is
Function prototype: char * strchr (const char * STR, char ch );
Return Value: returns a pointer pointing to the position where the character ch appears for the first time. If no ch is found in STR, null is returned.
Parameter description:
STR:
Char *strchr (const char *s, int c)Function: Find the position of the first C character in the string s
Description: Returns a pointer to the position of the first occurrence of C, the returned address is the first pointer to the string that is
In a longer string this finds matching strings or characters, where STRSTR () and STRCHR () are exactly the same.Cases:echo strstr (' Why all you ', ' you ');Output:YouIf you are:echo strstr (' Why all you ', ' you ');Then no outputThe Stristr ()
The simulation implements the STRCHR function, function: Finds a character in a string where the first occurrence occurs, if no return null#include #include char const* MY_STRCHR (char const *p,char c) {assert (P! = NULL), while (*p) {if (*p = = c)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.