42_solong/libftx/printf/ft_skipflag.c
Camille Chauvet 9e58abcd5c kekw
2022-12-22 17:54:17 +01:00

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_skipflag.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/12 14:47:52 by cchauvet #+# #+# */
/* Updated: 2022/10/12 16:14:07 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_skipflag(const char *str)
{
size_t i;
i = 0;
if (str[i] != '%')
return (0);
i++;
if (str[i] == '\0')
return (-1);
while (ft_isdigit(str[i]))
i++;
if (ft_isarg(str[i]))
return (i + 1);
return (0);
}