分类: LINUX
2008-08-12 13:25:25
strspn(返回字符串中连续不含指定字符串内容的字符数) |
||||||||||||||||||||
表头文件
|
#include |
|||||||||||||||||||
定义函数
|
size_t strspn (const char *s,const
char * accept); |
|||||||||||||||||||
函数说明
|
strspn()从参数s 字符串的开头计算连续的字符,而这些字符都完全是accept
所指字符串中的字符。简单的说,若strspn()返回的数值为n,则代表字符串s 开头连续有n 个字符都是属于字符串accept内的字符。 |
|||||||||||||||||||
返回值
|
返回字符串s开头连续包含字符串accept内的字符数目。 |
|||||||||||||||||||
范例
|
#include
|
|||||||||||||||||||
执行
|
5 /*计算大小写字母。不包含“ ”,所以返回Linux的长度。*/
Get span of character set in string Returns the length of the initial portion of str1 which consists only of characters that are part of str2. Parameters
Return valueThe length of the initial portion of str1 containing only characters that appear in str2.Therefore, if all of the characters in str1 are in str2, the function returns the length of the entire str1 string, and if the first character in str1 is not in str2, the function returns zero. ==========================================================
|