19.函数名: strrev
功 能: 串倒转
用 法: char *strrev(char *str);
程序例:
#include
#include
int main(void)
{
char *forward = "string";
printf("Before strrev(): %s
", forward);
strrev(forward);
printf("After strrev(): %s
", forward);
return 0;
}
20.函数名: strset
功 能: 将一个串中的所有字符都设为指定字符
用 法: char *strset(char *str, char c);
程序例:
#include
#include
int main(void)
{
char string[10] = "123456789";
char symbol = 'c';
printf("Before strset(): %s
", string);
strset(string, symbol);
printf("After strset(): %s
", string);
return 0;
}
21.函数名: strspn
功 能: 在串中查找指定字符集的子集的第一次出现
用 法: int strspn(char *str1, char *str2);
程序例:
#include
#include
#include
int main(void)
{
char *string1 = "1234567890";
char *string2 = "123DC8";
int length;
length = strspn(string1, string2);
printf("Character where strings differ is at position %d
", length);
return 0;
}
【发表评论0条 】