text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strmapi.c                                       :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: brel-baz <marvin@42.fr>                    +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2016/11/20 10:22:18 by brel-baz          #+#    #+#             */
  /*   Updated: 2016/11/27 01:07:43 by brel-baz         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
  {
  	char	*str;
  	size_t	i;
  
  	i = 0;
  	if (!s || !f)
  		return (NULL);
  	str = ft_strnew(ft_strlen(s));
  	if (!str)
  		return (NULL);
  	while (s[i])
  	{
  		str[i] = f(i, s[i]);
  		i++;
  	}
  	str[i] = '\0';
  	return (str);
  }
  