text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        ::::::::            */
  /*   ft_strmapi.c                                       :+:    :+:            */
  /*                                                     +:+                    */
  /*   By: goosterl <marvin@codam.nl>                   +#+                     */
  /*                                                   +#+                      */
  /*   Created: 2019/11/17 15:43:54 by goosterl      #+#    #+#                 */
  /*   Updated: 2019/11/28 22:09:02 by goosterl      ########   odam.nl         */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
  {
  	char	*str;
  	size_t	len;
  	size_t	i;
  
  	i = 0;
  	if (!s)
  		return (NULL);
  	len = ft_strlen((char *)s);
  	str = (char *)malloc((len + 1) * sizeof(char));
  	if (!str)
  		return (NULL);
  	while (s[i])
  	{
  		str[i] = (*f)(i, s[i]);
  		i++;
  	}
  	str[i] = '\0';
  	return (str);
  }
  