-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strsub.c
25 lines (22 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: twakrim <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/17 18:07:07 by twakrim #+# #+# */
/* Updated: 2018/10/23 14:05:04 by twakrim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *str;
str = ft_strnew(len);
if (str == NULL)
return (NULL);
if (s && len > 0)
ft_strncat(str, s + start, len);
return (str);
}