-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_base_is_valid.c
42 lines (39 loc) · 1.37 KB
/
ft_base_is_valid.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
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_base_is_valid.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yaretel- <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/26 10:55:50 by yaretel- #+# #+# */
/* Updated: 2022/11/11 16:30:51 by yaretel- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_base_is_valid(char *base)
{
int i;
int j;
int once;
if (ft_strlen(base) == 0 || ft_strlen(base) == 1)
return (0);
if (ft_charstr('+', base) == 1 || ft_charstr('-', base) == 1
|| ft_charstr(' ', base))
return (0);
ft_set3zero(&i, &j, &once);
while (base[i] != '\0')
{
while (base[j] != '\0')
{
if (base[i] == base[j] && once == 0)
once = 1;
else if (base[i] == base[j] && once != 0)
return (0);
j++;
}
j = 0;
once = 0;
i++;
}
return (1);
}