| 123456789101112131415161718192021222324252627282930313233343536 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strisdigit.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* 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);
- }
|