split_keep

This commit is contained in:
Nathan Lebrun
2025-01-21 12:02:30 +01:00
parent 2f97574a37
commit 281c8c0f63
4 changed files with 135 additions and 19 deletions

View File

@@ -3,29 +3,15 @@
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/11 16:15:47 by nalebrun #+# #+# */
/* Updated: 2024/11/27 12:58:41 by nalebrun ### ########.fr */
/* Created: 2025/01/21 11:31:07 by nalebrun #+# #+# */
/* Updated: 2025/01/21 11:31:07 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft.h"
static char **free_all(char **tab, int count)
{
int i;
i = 0;
while (i < count)
{
free(tab[i]);
i++;
}
free(tab);
return (NULL);
}
static int count_strings(char const *s, char *set)
{
int count;
@@ -33,8 +19,8 @@ static int count_strings(char const *s, char *set)
count = 0;
while (*s)
{
if (!is_charset(*s, set) && ( is_charset(*(s + 1), set)
|| *(s + 1) == '\0'))
if (!is_charset(*s, set) && (is_charset(*(s + 1), set)
|| *(s + 1) == '\0'))
count ++;
s++;
}