-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strsub.c
27 lines (24 loc) · 1.11 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: rtiutiun <rtiutiun@42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/10 20:10:58 by rtiutiun #+# #+# */
/* Updated: 2017/09/25 03:45:20 by rtiutiun ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *dst;
if (!s)
return (0);
dst = ft_strnew(len);
if (!dst)
return (0);
dst = ft_strncpy(dst, s + start, len);
dst[len] = '\0';
return (dst);
}