Reuse ft_isdigit and ft_strchr from libft

This commit is contained in:
gbaconni
2022-04-29 08:46:53 +02:00
parent 59977253fc
commit 38021fb98f
8 changed files with 114 additions and 10 deletions

View File

@@ -6,7 +6,7 @@
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:55:02 by gbaconni #+# #+# */
/* Updated: 2022/04/26 17:48:37 by gbaconni ### ########.fr */
/* Updated: 2022/04/29 08:42:35 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
@@ -42,9 +42,9 @@ int ft_vprintf_decimal(const char *format, va_list ap)
f = format;
while (*f != '\0')
{
if (*f >= '0' && *f <= '9')
if (ft_isdigit(*f))
precision = precision * 10 + *f - '0';
if (*f == 'c' || *f == 's' || *f == 'p' || *f == 'd' || *f == 'i' || *f == 'u' || *f == 'x' || *f == 'X' || *f == '%')
if (ft_strchr("cspdiuxX%", *f) != NULL)
break ;
f++;
}