Improve main by implementing fmtsplit to split format into chunks and pass function pointer to compare ft_printf with printf
This commit is contained in:
35
libftprintf/ft_skipchars.c
Normal file
35
libftprintf/ft_skipchars.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user