wcsstr
Header: <wchar.h>
- Finds the first occurrence of the wide string src in the wide string pointed to by dest. The terminating null characters are not compared.
# Declarations
wchar_t *wcsstr( const wchar_t *dest, const wchar_t *src );
(since C95)
/*QWchar_t*/ *wcsstr( /*QWchar_t*/ *dest, const wchar_t *src );
(since C23)
# Parameters
dest: pointer to the null-terminated wide string to examinesrc: pointer to the null-terminated wide string to search for
# Return value
Pointer to the first character of the found substring in dest, or a null pointer if no such substring is found. If src points to an empty string, dest is returned.
# Example
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
int main(void)
{
setlocale(LC_ALL, "ru_RU.UTF-8");
wchar_t str[5][64] = {
L"Строка, где есть подстрока 'но'.",
L"Строка, где такой подстроки нет.",
L"Он здесь.",
L"Здесь он.",
L"Его нет."
};
for (size_t i = 0; i < 5; ++i) {
if (wcsstr(str[i], L"но")) {
wprintf(L"%ls\n", str[i]);
}
}
}