wcspbrk() function in C/C++ Last Updated : 10 Feb, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The wcspbrk() is a built-in function in C/C++ which searches for a set of wide characters present in a wide string in another wide string. It is defined within the cwchar header file of C++. Syntax: wcspbrk(dest, src) Parameters: The function has two parameters as shown below. dest: It specifies the null terminated wide string to be searched.src: It specifies a null terminated wide string containing the characters to search for. Return Value: The function returns two values as follows: If there are one or more than one common wide characters, in dest and src, the function returns the pointer to the first wide character in dest that is also in src.If no wide characters is common in src & dest, a null pointer is returned. Below programs illustrate the above function. Program 1: CPP // C++ program to illustrate the // wcspbrk() function #include <cwchar> #include <iostream> using namespace std; int main() { wchar_t src[] = L"Ishwar Gupta"; wchar_t dest[] = L"GeeksforGeeks"; wchar_t* s = wcspbrk(dest, src); int pos; if (s) { pos = s - dest; wcout << L"First occurrence in \"" << dest << L"\" is at position " << pos << endl; } else wcout << L"No number found in \"" << dest << "\""; return 0; } Output:First occurrence in "GeeksforGeeks" is at position 0 Program 2: CPP // C++ program to illustrate the // wcspbrk() function #include <cwchar> #include <iostream> using namespace std; int main() { wchar_t src[] = L"123"; wchar_t dest[] = L"Hello World"; wchar_t* s = wcspbrk(dest, src); int pos; if (s) { pos = s - dest; wcout << L"First occurrence in \"" << dest << L"\" is at position " << pos << endl; } else wcout << L"No common wide character"; return 0; } Output:No common wide character Comment More infoAdvertise with us Next Article wcspbrk() function in C/C++ I IshwarGupta Follow Improve Article Tags : C++ CPP-Functions C-Library Practice Tags : CPP Similar Reads wcsncmp() function in C/C++ The wcsncmp() function in C/C++ compare characters of two wide strings. The comparison is done lexicographically. This function takes three arguments lhs, rhs and count. It compares the contents of lhs and rhs lexicographically upto a maximum of count wide characters. Note: The behaviour of wcsncmp( 3 min read wcscspn() function in C/C++ The wcscspn() function in C/C++ searches the first occurrence of a wide character of string_2 in the given wide string_1. It returns the number of wide characters before the first occurrence of that wide character . The search includes the terminating null wide characters. Therefore, the function wi 2 min read wcsrchr() function in C/C++ The wcsrchr() function is a builtin function in C/C++ which searches for the last occurrence of a wide character in a wide string. It is defined within the cwchar header file in C++. Syntax: wcsrchr(str, ch) Parameters: The function accepts two parameters which are described below. str: It specifies 2 min read wcstol() function in C/C++ The wcstol() function in C/C++ converts the given wide string to a long integer. This function sets a pointer to point to the first character after the last valid character of the wide string if there is any, otherwise, the pointer is set to null. This function ignores all the leading whitespace cha 3 min read wcschr() function in C++ wcschr() function in C++ searches for the first occurrence of a wide character in a wide string. The terminating null wide character is considered part of the string. Therefore, it can also be located in order to retrieve a pointer to the end of a wide string. Syntax: const wchar_t* wcschr (const wc 2 min read Like