36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
|
|
/* ************************************************************************** */
|
||
|
|
/* */
|
||
|
|
/* ::: :::::::: */
|
||
|
|
/* ft_skipchars.c :+: :+: :+: */
|
||
|
|
/* +:+ +:+ +:+ */
|
||
|
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||
|
|
/* +#+#+#+#+#+ +#+ */
|
||
|
|
/* Created: 2022/04/23 23:49:26 by gbaconni #+# #+# */
|
||
|
|
/* Updated: 2022/04/24 00:00:43 by gbaconni ### lausanne.ch */
|
||
|
|
/* */
|
||
|
|
/* ************************************************************************** */
|
||
|
|
|
||
|
|
#include "libftprintf.h"
|
||
|
|
|
||
|
|
int ft_skipchars(const char *s, char *chars)
|
||
|
|
{
|
||
|
|
int ret;
|
||
|
|
int i;
|
||
|
|
int hits;
|
||
|
|
|
||
|
|
ret = 0;
|
||
|
|
while (*s != '\0')
|
||
|
|
{
|
||
|
|
i = 0;
|
||
|
|
hits = 0;
|
||
|
|
while (chars[i] != '\0')
|
||
|
|
hits += (chars[i++] == *s);
|
||
|
|
if (hits > 0)
|
||
|
|
ret++;
|
||
|
|
else
|
||
|
|
break ;
|
||
|
|
s++;
|
||
|
|
}
|
||
|
|
return (ret);
|
||
|
|
}
|