This commit is contained in:
hugodu69
2019-12-13 21:15:07 +01:00
parent 9396471afe
commit 48c0ec9108
2 changed files with 6 additions and 4 deletions

View File

@@ -29,7 +29,7 @@
** } ** }
** char touppercase(unsigned int i, char c) ** char touppercase(unsigned int i, char c)
** { ** {
** if (i < 3) ** if (i < 3 && c >= 'a' && c <= 'z')
** c -= 32; ** c -= 32;
** return (c); ** return (c);
** } ** }

View File

@@ -4,7 +4,7 @@
char touppercase(unsigned int i, char c) char touppercase(unsigned int i, char c)
{ {
if (i < 3 && 'a' <= c <= 'z') if (i < 3 && c >= 'a' && c <= 'z')
c -= 32; c -= 32;
return (c); return (c);
} }
@@ -20,7 +20,7 @@ void print_ft_split(char *str, char c)
printf("split : [%s] [%c] -> ", str, c); printf("split : [%s] [%c] -> ", str, c);
tab = ft_split(str, c); tab = ft_split(str, c);
while (*tab != NULL) while (tab && *tab != NULL)
printf("[%s]", *(tab++)); printf("[%s]", *(tab++));
printf("\n"); printf("\n");
} }
@@ -65,8 +65,10 @@ int main()
printf("\n"); printf("\n");
print_ft_split(" dfs zfe f ez f fez ", ' '); print_ft_split(" dfs zfe f ez f fez ", ' ');
// print_ft_split(NULL, 0); print_ft_split(NULL, ' ');
print_ft_split(NULL, 0);
print_ft_split("", 0); print_ft_split("", 0);
print_ft_split("vzevzev fze", 0);
print_ft_split(" ", 0); print_ft_split(" ", 0);
print_ft_split("", ' '); print_ft_split("", ' ');
print_ft_split(" ", ' '); print_ft_split(" ", ' ');