Piscine42/C02/ex03/ft_str_is_numeric.c
2023-12-12 17:25:55 +01:00

35 lines
1.1 KiB
C
Executable File

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 17:46:52 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 17:06:15 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
int i;
i = 0;
if (str[i] == '\0')
{
return (1);
}
while (str[i] != '\0')
{
if ((str[i] >= 48 && str[i] <= 57))
{
i++;
}
else
{
return (0);
}
}
return (1);
}