wcsspn ()- 查找第一个不匹配宽字符的偏移
格式
#include <wchar.h>
size_t wcsspn(const wchar_t *string1, const wchar_t *string2);语言级别
ANSI
线程安全
是
宽字符函数
有关更多信息,请参阅 宽字符 。
描述
wcsspn() 函数计算 string1所指向的字符串初始段中的宽字符数,这完全由 string2所指向的字符串中的宽字符组成。
返回值
wcsspn() 函数返回段中的宽字符数。
示例
此示例发现数组 string 中首次出现的宽字符不是 a, b或 c。 因为此示例中的字符串是 大白菜,所以
wcsspn() 函数返回 5,即 大白菜 的分段的索引在不是 a, b或 c的字符之前。#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t * string = L"cabbage";
wchar_t * source = L"abc";
int index;
index = wcsspn( string, L"abc" );
printf( "The first %d characters of \"%ls\" are found in \"%ls\"\n",
index, string, source );
}
/**************** Output should be similar to: ******************
The first 5 characters of "cabbage" are found in "abc"
*/
相关信息
- strchr ()-搜索字符
- strcspn ()-查找第一个字符匹配的偏移量
- strpbrk ()-查找字符串中的字符
- strrchr ()-查找字符串中最后出现的字符
- strspn ()-查找第一个不匹配字符的偏移量
- wcscat ()-Concatenate 宽字符字符串
- wcschr ()-搜索宽字符
- wcscmp ()-比较宽字符字符串
- wcscspn ()-查找第一个宽字符匹配的偏移量
- wcsncmp ()-比较宽字符字符串
- wcspbrk ()-在字符串中查找宽字符
- wcsrchr ()-查找字符串中最后出现的宽字符
- wcsspn ()-查找第一个非匹配宽字符的偏移量
- wcswcs ()-查找宽字符子串
- <wchar.h>