/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lclerel- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/03/18 10:29:59 by lclerel- #+# #+# */ /* Updated: 2026/03/18 18:19:30 by lclerel- ### ########.fr */ /* */ /* ************************************************************************** */ #include #include char **ft_split(char *str, char *charset) { int i; int j; int k; char **res; res = malloc(sizeof(char *) * (ft_words(str, charset) + 1)); if (!res || (i = 0) == 1) return (NULL); j = 0; while (str[i]) { while (str[i] && ft_sep(str[i], charset)) i++; res[j] = malloc(sizeof(char) * (len + 1)); if (!res[j]) return (NULL); if (str[i] ) } } int ft_sep(char c, char *charset) { int i; i = 0; while (charset[i]) { if (c == charset[i]) return (1); i++; } return (0); } int ft_words(char *str, char *charset) { int i; int count; count = 0; i = 0; while (str[i]) { if (ft_sep(str[i], charset) == 0 && (i == 0 || is_sep(str[i - 1], charset) == 1)) { count++; } i++; } return (count); } /*int main(void) { }*/