diff options
Diffstat (limited to 'c02/ex03/ft_str_is_numeric.c')
| -rw-r--r-- | c02/ex03/ft_str_is_numeric.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/c02/ex03/ft_str_is_numeric.c b/c02/ex03/ft_str_is_numeric.c new file mode 100644 index 0000000..b73450e --- /dev/null +++ b/c02/ex03/ft_str_is_numeric.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_str_is_numeric.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/03 19:26:04 by cacharle #+# #+# */ +/* Updated: 2019/07/03 19:39:25 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int is_between(char start, char end, char subject) +{ + return (subject >= start && subject <= end); +} + +int ft_str_is_numeric(char *str) +{ + while (*str != '\0') + if (!is_between('0', '9', *str)) + return (0); + return (1); +} |
