The wcsstr() function is defined in cwchar.h header file. The wcsstr() function finds the first occurrence of a source in a destination string.
wchar_t* wcsstr(const wchar_t* dest, const wchar_t* src);
Parameter: This method accepts the following parameters:
- src: It represents the pointer to the null terminating wide string to be search for.
- dest: It represents the pointer to the null terminating wide string in which we have to search.
Return Value: The return value of this method depeneds on:
- If src is not found than it returns NULL
- If src points to an empty string then destination is return
- If the src is found, the wcsstr() function returns the pointer to the first wide character of the src in dest.
Below program illustrate the above function:
Example 1: When the source is not found, null is returned
Example 2: When the source is empty, destination string is returned
Geeks Are Geeks
Example 3: When the source is found, the destination from the source is returned.
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- Function Interposition in C with an example of user defined malloc()
- tellg() function in C++ with example
- wcstok() function in C++ with example
- wcsncpy() function in C++ with example
- Buffer Overflow Attack with Example
- ftell() in C with example
- fseek() in C/C++ with example
- Writing first C++ program : Hello World example
- std::search_n with example in C++
- tellp() in file handling with c++ with example
- vector::crend() & vector::crbegin() with example
- forward_list::cend() in C++ STL with Example
- Vector removeElement() method in Java with Example
- Vector removeRange() method in Java with Example
- Vector toString() method in Java with Example
- Vector setSize() method in Java with Example
- Vector trimToSize() method in Java with Example
- ConcurrentLinkedDeque peek() method in Java with Example
- ConcurrentLinkedDeque poll() method in Java with Example
- Vector setElementAt() method in Java with Example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Vijay Sirra