トップページ > キーワード検索 > strcspn()
C言語規格
C言語(その他)
プログラム
その他
strcspn()
機能 文字群の文字が含まれない先頭部分の長さを計算する。
定義 #include <string.h>

size_t strcspn ( const char * s1, const char * s2 );
引数
s1対象文字列
s2文字群
戻り値 該当する先頭部分の長さを返す。
実装例
#include <string.h>
#include <stdio.h>

int main(void)
{
    char str[] = "abcde";
    size_t ret;
    
    ret = strcspn(str, "ed");
    
    printf("%d : %s\n", ret, &str[ret]);
    
    return 0;
}
実行結果
3 : de





inserted by FC2 system