-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_strsub.c
26 lines (23 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
25
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: psprawka <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/09/21 19:33:53 by psprawka #+# #+# */
/* Updated: 2018/06/17 13:44:56 by psprawka ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char *str, int start, size_t len)
{
char *new;
int i;
if (!str || !(new = ft_strnew(len)))
return (NULL);
i = 0;
while (len--)
new[i++] = str[start++];
return (new);
}