-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_str_is_numeric.c
More file actions
38 lines (34 loc) · 1.13 KB
/
ft_str_is_numeric.c
File metadata and controls
38 lines (34 loc) · 1.13 KB
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
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbin-jef <sbin-jef@student.42kl.edu.my> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/08 11:12:54 by sbin-jef #+# #+# */
/* Updated: 2024/05/09 11:21:23 by sbin-jef ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int check(char x)
{
if (!(x >= '0' && x <= '9'))
{
return (0);
}
return (1);
}
int ft_str_is_numeric(char *str)
{
int num;
num = 0;
while (str[num] != '\0')
{
if (!check(str[num]))
{
return (0);
}
num++;
}
return (1);
}