libftx/printf/ft_skipflag.c

31 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-01-19 11:33:26 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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);
}