c语言在串中查找第一个给定字符集内容的段函数

来源:百度文库 编辑:神马文学网 时间:2024/04/29 19:52:55
函数名: strcspn
功  能: 在串中查找第一个给定字符集内容的段
用  法: int strcspn(char *str1, char *str2);
程序例:

#include
#include
#include

int main(void)
 {
    char *string1 = "1234567890";
    char *string2 = "747DC8";
    int length;

    length = strcspn(string1, string2);
    printf("Character where strings intersect is at position %d\n", length);

    return 0;
 }