-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strsub.c
More file actions
28 lines (25 loc) · 1.11 KB
/
ft_strsub.c
File metadata and controls
28 lines (25 loc) · 1.11 KB
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
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nhennigh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/12 18:09:55 by nhennigh #+# #+# */
/* Updated: 2019/02/15 18:15:40 by nhennigh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *str;
int i;
if (!s)
return (NULL);
i = 0;
if (!(str = ft_strnew(len)))
return (NULL);
while (len--)
str[i++] = s[start++];
return (str);
}