-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_str_is_numeric.c
34 lines (30 loc) · 1.21 KB
/
ft_str_is_numeric.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
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lsauvage <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/29 15:30:52 by lsauvage #+# #+# */
/* Updated: 2017/11/29 15:34:20 by lsauvage ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** DESCRIPTION : Verifie si une chaine de caracteres est constituee uniquement
** de chiffres ('0'->'9').
**
** RETOUR : Renvoie 1 si str est constituee de chiffres, 0 sinon.
*/
int ft_str_is_numeric(char *str)
{
int i;
i = 0;
while (str[i])
{
if (!(ft_isdigit(str[i])))
return (0);
i++;
}
return (1);
}