-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_checkbase.c
35 lines (32 loc) · 1.25 KB
/
ft_checkbase.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_checkbase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: smbaabu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/19 18:44:02 by smbaabu #+# #+# */
/* Updated: 2019/03/21 23:23:46 by smbaabu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_checkbase(char *base)
{
int i;
if (base == NULL || *base == 0 || !base[1])
return (0);
i = 1;
while ((base[i]))
{
if (base[i] == '+' || base[i] == '-')
return (0);
if (base[i] - base[i - 1] != 1)
if (!(ft_isdigit(base[i - 1])
&& (base[i] == 'a' || base[i] == 'A')))
return (0);
i++;
}
if (base[i])
return (0);
return (i);
}