text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strmapi.c                                       :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: sstench <marvin@42.fr>                     +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2019/09/19 17:35:41 by sstench           #+#    #+#             */
  /*   Updated: 2019/09/19 18:16:38 by sstench          ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
  {
  	size_t	index;
  	char	*new;
  
  	index = 0;
  	if (!s || !f)
  		return (NULL);
  	new = ft_strnew(ft_strlen(s));
  	if (new == NULL)
  		return (NULL);
  	while (s[index])
  	{
  		new[index] = (*f)(index, s[index]);
  		index++;
  	}
  	return (new);
  }
  