blob: da2d7fc6c8805c3fc8b5dd27ab3d23af79be8a42 (
plain)
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
43
44
45
46
47
48
49
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 15:58:03 by cacharle #+# #+# */
/* Updated: 2019/07/09 09:40:49 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int count_segment(char *str, char *charset)
{
int counter;
int i;
counter = 0;
while (*str)
{
i = 0;
while (charset[i])
if (str++ == charset[i++])
counter++;
str++;
}
return (counter);
}
int strlen_until_sep(char *str, char *charset)
{
}
char **ft_split(char *str, char *charset)
{
char **strs;
strs = (char**)malloc(sizeof(char*) * count_segment(str, charset));
printf("%d\n", count_segment(str, charset));
/*while (*str)*/
/*{*/
/*str++;*/
/*}*/
return (strs);
}
|