zoukankan      html  css  js  c++  java
  • C 库函数

    定义

    size_t strcspn(const char *str1, const char *str2)

    参数

    str1 -- 要被检索的 C 字符串。
    str2 -- 该字符串包含了要在 str1 中进行匹配的字符列表。

    描述

    该函数返回 str1 开头连续都不含字符串 str2 中字符的字符数。

    例子

    #include <stdio.h>
    #include <string.h>
    
    int main ()
    {
       int len;
       const char str1[] = "ABCDEF4960910";
       const char str2[] = "013";
    
       len = strcspn(str1, str2);
    
       printf("第一个匹配的字符是在 %d
    ", len + 1);
       return(0);
    }

    输出

    第一个匹配的字符是在 10

    参考:

    https://www.runoob.com/cprogramming/c-function-strcspn.html

  • 相关阅读:
    NYOJ 35
    TOJ 3072
    HDU 1075
    POJ 1028
    TOJ 1153
    TOJ 1036
    POJ 1521
    POJ 3253
    NYOJ 467
    HDU 1671
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11219771.html
Copyright © 2011-2022 走看看