-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strsub.c
27 lines (24 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cprune <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/30 11:38:52 by cprune #+# #+# */
/* Updated: 2015/12/07 15:45:23 by cprune ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *str;
int i;
i = 0;
if (!(str = ft_strnew(len)))
return (NULL);
while (len--)
str[i++] = s[start++];
str[i] = '\0';
return (str);
}