31 lines
1.1 KiB
C
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);
|
|
}
|