-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strnlstrip.c
executable file
·32 lines (29 loc) · 1.26 KB
/
ft_strnlstrip.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnlstrip.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <akharrou@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/19 10:42:13 by akharrou #+# #+# */
/* Updated: 2019/05/19 10:42:14 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/ctype_42.h"
#include "../Includes/stdlib_42.h"
#include "../Includes/string_42.h"
char *ft_strnlstrip(char const *s, char *charset, int n)
{
int first;
char *lstripped;
if (s)
{
first = 0;
while (n-- > 0 && s[first] && ft_ischarset(s[first], charset))
++first;
lstripped = ft_strdup(s + first);
free((void *)s);
return (lstripped);
}
return (NULL);
}