열렬히.뛰기

ft_strcspn

école 42 > exam02 > exam02 : part2 > ft_strcspn

문제

Assignment name	: ft_strcspn
Expected files	: ft_strcspn.c
Allowed functions: None
---------------------------------------------------------------

Reproduce exactly the behavior of the function strcspn
(man strcspn).

The function should be prototyped as follows:

size_t	ft_strcspn(const char *s, const char *reject);

해당 함수에 대한 설명

c
#include <string.h>

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

str2 에 들어있는 문자들 중에서 str1  중 첫 번째로 일치하는 문자까지 읽어야 하는 문자 수를 리턴한다.

  • string complement span 의 약자
  • 보완 구간을 찾는다고 생각하면 될 듯.
  • 아예 없다면 str2의 마지막 i를 보내면 됨.