maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_is_num.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_is_num.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: rmikhayl <marvin@42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/05/15 14:49:25 by rmikhayl #+# #+# */
9
/* Updated: 2024/05/15 14:49:27 by rmikhayl ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
libft.h
"
14
15
int
ft_is_num
(
const
char
*n)
16
{
17
unsigned
long
i;
18
19
i = 0;
20
while
(n[i] && (n[i] ==
'\t'
|| n[i] ==
'\n'
|| n[i] ==
'\v'
21
|| n[i] ==
'\f'
|| n[i] ==
'\r'
|| n[i] ==
' '
))
22
i++;
23
if
(n[i] && (n[i] ==
'+'
|| n[i] ==
'-'
))
24
i++;
25
if
(!n[i])
26
return
(
FALSE
);
27
while
(n[i])
28
{
29
if
(!
ft_isdigit
(n[i]))
30
return
(
FALSE
);
31
i++;
32
}
33
return
(
TRUE
);
34
}
ft_is_num
int ft_is_num(const char *n)
Definition
ft_is_num.c:15
libft.h
ft_isdigit
int ft_isdigit(int c)
Definition
ft_isdigit.c:13
TRUE
#define TRUE
Definition
libft.h:104
FALSE
#define FALSE
Definition
libft.h:105
lib
libft
src
ft_is_num.c
Generated by
1.9.8