mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
finish the bonus just need to verify some files i guess
This commit is contained in:
44
check_error/verif_is_digit.c
Normal file
44
check_error/verif_is_digit.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* verif_is_digit.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/09 10:25:23 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/09 10:25:24 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing.h"
|
||||
|
||||
int scan_str_is_digit(char *tab)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (tab[i])
|
||||
{
|
||||
if ((tab[i] == '+' || tab[i] == '-') && ft_isdigit(tab[i + 1])
|
||||
&& tab[i + 1])
|
||||
i++;
|
||||
if (!ft_isdigit(tab[i]))
|
||||
return (0);
|
||||
i++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
int verif_is_digit(char **tab, int mod)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = wich_mod(mod);
|
||||
while (tab[i])
|
||||
{
|
||||
if (!scan_str_is_digit(tab[i]))
|
||||
return (0);
|
||||
i++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
Reference in New Issue
Block a user