/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strisdigit.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/06/16 16:16:37 by bchanot #+# #+# */ /* Updated: 2016/10/16 22:09:34 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_strisdigit(char *str) { int i; int end; i = -1; end = 0; while (str[++i] == ' ') ; if (str[i] == '-' || str[i] == '+') i++; while (str[i]) { if ((str[i] >= 48 && str[i] <= 57) && end == 0) i++; else if (str[i] == ' ' && end == 0) end = 1; else return (0); } return (1); }