-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strsub.c
24 lines (21 loc) · 1.08 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rodrodri <[email protected] > +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/30 14:41:03 by rodrodri #+# #+# */
/* Updated: 2021/11/14 23:56:21 by rodrodri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *substr;
substr = ft_strnew(len);
if (!substr)
return (NULL);
ft_strncpy(substr, s + start, len);
return (substr);
}