From 3a2d19df9e509d0b015c786eb02f8315ff0ad91c Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 5 Apr 2020 14:05:43 +0200 Subject: Renamed ft_substr to ft_strsub, Added ft_strsubf, ft_strcat3 --- src/str/ft_strsubf.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/str/ft_strsubf.c (limited to 'src/str/ft_strsubf.c') diff --git a/src/str/ft_strsubf.c b/src/str/ft_strsubf.c new file mode 100644 index 0000000..dc49ba5 --- /dev/null +++ b/src/str/ft_strsubf.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strsubf.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/05 13:48:13 by charles #+# #+# */ +/* Updated: 2020/04/05 13:51:47 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_str.h" + +/* +** \brief Wrapper around ft_substr which free the original string +** \param s String to extract from (will be free) +** \param start Starting index of the substring +** \param len Substring length +** \return The created substring or NULL on error +*/ + +char *ft_strsubf(char const *s, size_t start, size_t len) +{ + char *ret; + + ret = ft_strsub(s, start, len); + free((void*)s); + return (ret); +} -- cgit