strspn.c

来自「Many C samples. It is a good sample for 」· C语言 代码 · 共 25 行

C
25
字号
/*  File   : strspn.c
    Author : Richard A. O'Keefe.
    Updated: 11 April 1984
    Defines: strspn()

    strspn(s1, s2) returns the  length  of  the  longest  prefix  of  s1
    consisting  entirely  of characters in s2.  NUL is not considered to
    be in s2, and _str2set will not include it in the set.
*/

#include "strings.h"
#include "_str2set.h"

int strspn(str, set)
    register _char_ *str;
    char *set;
    {
	register int L;

	_str2set(set);
	for (L = 0; _set_vec[*str++] == _set_ctr; L++) ;
	return L;
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?