-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strjoin_sep.c
executable file
·27 lines (24 loc) · 1.29 KB
/
ft_strjoin_sep.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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strjoin_sep.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: brobicho <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/07/25 15:55:52 by brobicho #+# ## ## #+# */
/* Updated: 2018/07/25 15:55:55 by brobicho ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin_sep(char const *s1, char const *sep, char const *s2)
{
char *str_new;
if (!(str_new = ft_strnew((ft_strlen(s1) + ft_strlen(s2)
+ ft_strlen(sep)))))
return (NULL);
str_new = ft_strcpy(str_new, s1);
str_new = ft_strcat((char *)str_new, sep);
str_new = ft_strcat(str_new, s2);
return (str_new);
}