-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_str_isdigit.c
29 lines (26 loc) · 1.07 KB
/
ft_str_isdigit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_isdigit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alaparic <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/11 12:40:01 by alaparic #+# #+# */
/* Updated: 2023/08/16 12:00:00 by alaparic ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_str_isdigit(char *str)
{
int n;
n = 0;
if (str[n] == '-' || str[n] == '+')
n++;
while (str[n])
{
if (!ft_isdigit(str[n]))
return (0);
n++;
}
return (1);
}