maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
isnum_from_str.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* isnum_from_str.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: rmikhayl <rmikhayl@student.42london.ac.uk> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/12/17 17:25:27 by rmikhayl #+# #+# */
9/* Updated: 2024/04/15 16:46:47 by rocky ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15int isnum_from_str(const char *str)
16{
17 if (!str || *str == '\0')
18 return (0);
19 if (*str == '-' || *str == '+')
20 {
21 str++;
22 if (*str == '\0')
23 return (0);
24 }
25 while (*str)
26 {
27 if (*str < '0' || *str > '9')
28 return (0);
29 str++;
30 }
31 return (1);
32}
int isnum_from_str(const char *str)