ft_isnum.c 1.1 KB

12345678910111213141516171819202122232425262728
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_isnum.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2016/07/20 14:23:27 by bchanot #+# #+# */
  9. /* Updated: 2016/07/20 14:25:22 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. int ft_isnum(const char *s)
  14. {
  15. if (*s == '+' || *s == '-')
  16. s++;
  17. if (*s == '\0')
  18. return (0);
  19. while (*s)
  20. {
  21. if (!ft_isdigit(*s))
  22. return (0);
  23. s++;
  24. }
  25. return (1);
  26. }