maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_is_double.c File Reference
#include "libft.h"
Include dependency graph for ft_is_double.c:

Go to the source code of this file.

Functions

int ft_is_double (const char *n)
 

Function Documentation

◆ ft_is_double()

int ft_is_double ( const char *  n)

Definition at line 15 of file ft_is_double.c.

16{
17 unsigned long i;
18 int p;
19
20 i = 0;
21 while (n[i] && (n[i] == '\t' || n[i] == '\n' || n[i] == '\v'
22 || n[i] == '\f' || n[i] == '\r' || n[i] == ' '))
23 i++;
24 if (n[i] && (n[i] == '+' || n[i] == '-'))
25 i++;
26 if (!n[i])
27 return (FALSE);
28 p = FALSE;
29 while (n[i])
30 {
31 if (!ft_isdigit(n[i]) && n[i] != '.' && n[i] != ',')
32 return (FALSE);
33 if ((n[i] == '.' || n[i] == ',') && p == TRUE)
34 return (FALSE);
35 if (n[i] == '.' || n[i] == ',')
36 p = TRUE;
37 i++;
38 }
39 return (TRUE);
40}
int ft_isdigit(int c)
Definition ft_isdigit.c:13
#define TRUE
Definition libft.h:104
#define FALSE
Definition libft.h:105

References FALSE, ft_isdigit(), and TRUE.

Here is the call graph for this function: