-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strsub.c
26 lines (23 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
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: snechaev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/22 16:46:37 by snechaev #+# #+# */
/* Updated: 2019/02/22 18:36:20 by snechaev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *new;
if (!s)
return (0);
new = ft_strnew(len);
if (!new)
return (NULL);
ft_strncpy(new, s + start, len);
return (new);
}