This repository has been archived on 2023-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
c_piscine_rush_02/ex00/ft_utils.c

53 lines
1.3 KiB
C
Raw Normal View History

/* ************************************************************************** */
/* */
/* ::: :::::::: */
2023-12-03 14:03:56 +00:00
/* ft_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 21:56:30 by achubuko #+# #+# */
2023-12-03 19:36:55 +00:00
/* Updated: 2023/12/03 21:58:36 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_utils.h"
2023-12-03 19:36:55 +00:00
t_dec ft_atoui32(char *str)
{
2023-12-03 19:36:55 +00:00
t_dec dec;
dec.significant = 0;
dec.base = 1;
while (*str)
{
}
return (dec);
}
size_t ft_strlen(char *s)
{
size_t l;
l = 0;
while (*s++)
l++;
return (l);
}
2023-12-03 14:09:56 +00:00
int ft_str_is_numeric(char *str)
2023-12-03 14:03:56 +00:00
{
2023-12-03 14:09:56 +00:00
int i;
2023-12-03 14:03:56 +00:00
i = 0;
if (str[i] == '\0')
return (0);
2023-12-03 14:21:17 +00:00
if (str[i] == '-')
return (-1);
2023-12-03 14:03:56 +00:00
while (str[i] != '\0')
{
if (str[i] < '0' || str[i] > '9')
return (0);
i++;
}
return (1);
}