mirror of
https://github.com/Ladebeze66/pushswap.git
synced 2025-12-15 21:56:54 +01:00
59 lines
1.4 KiB
C
Executable File
59 lines
1.4 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* input_check_utils.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/07/31 21:17:55 by fgras-ca #+# #+# */
|
|
/* Updated: 2023/07/31 21:23:45 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "push_swap.h"
|
|
|
|
int is_digit(char c)
|
|
{
|
|
return (c >= '0' && c <= '9');
|
|
}
|
|
|
|
int is_sign(char c)
|
|
{
|
|
return (c == '+' || c == '-');
|
|
}
|
|
|
|
int nbstr_cmp(const char *s1, const char *s2)
|
|
{
|
|
int i;
|
|
int j;
|
|
|
|
i = 0;
|
|
j = i;
|
|
if (s1[i] == '+')
|
|
{
|
|
if (s2[j] != '+')
|
|
i++;
|
|
}
|
|
else
|
|
{
|
|
if (s2[j] == '+')
|
|
j++;
|
|
}
|
|
while (s1[i] != '\0' && s2[j] != '\0' && s1[i] == s2[j])
|
|
{
|
|
i++;
|
|
j++;
|
|
}
|
|
return ((unsigned char)s1[i] - (unsigned char)s2[j]);
|
|
}
|
|
|
|
int size_numbers(char **numbers)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
while (numbers[i])
|
|
i++;
|
|
return (i + 1);
|
|
}
|