#C 语言标准库函数 wcsstr
#include <wchar.h>
wchar_t *wcsstr(const wchar_t *s, const wchar_t *needle);
说明
查找第一次出现的宽子串。
子串为空时返回原串起始地址。 C23 的类型通用调用保留被搜索对象的 const 限定,上面展示普通函数原型。
自 C95 起提供。
参数
s- 被查找的宽字符数组。以空宽字符结束。needle- 要找的宽子串。
返回值
- 匹配时返回原数组中的位置,未找到时返回空指针。
#示例
#include <wchar.h>
int main(void)
{
const wchar_t text[] = L"ABBA";
const wchar_t *match = wcsstr(text, L"BA");
return match != text + 2;
}