-
Notifications
You must be signed in to change notification settings - Fork 2
/
ft_strsub.c
32 lines (29 loc) · 1.14 KB
/
ft_strsub.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_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rlambert <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/05 14:52:59 by rlambert #+# #+# */
/* Updated: 2014/11/07 18:49:20 by rlambert ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *sub;
size_t i;
sub = ft_strnew(len);
if (sub == NULL)
return (NULL);
s = s + start;
i = 0;
while (i < len)
{
sub[i] = s[i];
i++;
}
return (sub);
}