/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strmapi.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hexplor +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/23 11:52:03 by hexplor #+# #+# */ /* Updated: 2023/11/30 09:04:01 by yantoine ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) { unsigned int i; char *str; i = 0; str = ft_calloc((ft_strlen(s) + 1), 1); if (!str) return (0); while (*(s + i)) { *(str + i) = f(i, *(s + i)); i++; } *(str + i) = '\0'; return (str); }