From 944a236443bacf531085b346d06907b24e3739b1 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 5 Apr 2020 01:11:50 +0200 Subject: Added ft_dstrerase, ft_dstrsubstitute --- src/dstr/ft_dstrsubstitute.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/dstr/ft_dstrsubstitute.c (limited to 'src/dstr/ft_dstrsubstitute.c') diff --git a/src/dstr/ft_dstrsubstitute.c b/src/dstr/ft_dstrsubstitute.c new file mode 100644 index 0000000..84adc29 --- /dev/null +++ b/src/dstr/ft_dstrsubstitute.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_dstrsubstitute.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/05 00:22:55 by charles #+# #+# */ +/* Updated: 2020/04/05 00:38:40 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_dstr.h" + +/* +** \brief Substitute part of a dynamic string for an other string +** \param dstr Dynamic string to substitute in +** \param replacement Replacement text +** \param start Substitution start index +** \param len Substitution length +*/ + +t_ftdstr *ft_dstrsubstitute( + t_ftdstr *dstr, + char *replacement, + size_t start, + size_t len +) +{ + ft_dstrerase(dstr, start, len); + return (ft_dstrinsert(dstr, replacement, start)); +} -- cgit