42_solong/libftx/printf/ft_skipflag.c

31 lines
1.1 KiB
C
Raw Permalink Normal View History

2022-12-22 11:54:17 -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);
}