22static size_t count_sections(
char const *s,
char c)
31 if (s[i] != c && (!i || s[i - 1] == c))
38static char **free_all(
char **arr)
49static size_t end_of_word(
char const *s,
char c)
80 arr =
ft_calloc(count_sections(s, c) + 1,
sizeof(
char *));
86 len = end_of_word(s, c);
89 return (free_all(arr));
void * ft_calloc(size_t count, size_t size)
Allocates count * size bytes with malloc and returns a pointer to the result.
char ** ft_split(char const *s, char c)
Split string s by characer c into allocated array of strings, with NULL as the last element.
size_t ft_strlen(const char *str)
Get length of str.
char * ft_substr(char const *s, unsigned int start, size_t len)
Allocates and returns a substring of s, starting at s + start, and ending no later than s + start + l...