46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_utils.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/12/02 21:56:30 by achubuko #+# #+# */
|
|
/* Updated: 2023/12/03 18:07:15 by achubuko ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "ft_utils.h"
|
|
|
|
uint32_t ft_atoui32(char *str)
|
|
{
|
|
return (*str - '0');
|
|
}
|
|
|
|
size_t ft_strlen(char *s)
|
|
{
|
|
size_t l;
|
|
|
|
l = 0;
|
|
while (*s++)
|
|
l++;
|
|
return (l);
|
|
}
|
|
|
|
int ft_str_is_numeric(char *str)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
if (str[i] == '\0')
|
|
return (0);
|
|
while (str[i] != '\0')
|
|
{
|
|
if (str[i] < '0' || str[i] > '9')
|
|
return (0);
|
|
i++;
|
|
}
|
|
if (str[0] == '-')
|
|
return (-1);
|
|
return (1);
|
|
}
|