text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strmapi.c                                       :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: vgrebeni <marvin@42.fr>                    +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2017/01/18 14:45:39 by vgrebeni          #+#    #+#             */
  /*   Updated: 2017/01/18 14:45:39 by vgrebeni         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  #include <stdlib.h>
  
  char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
  {
  	char			*new;
  	unsigned int	i;
  
  	if (!s || !f)
  		return (NULL);
  	new = ft_strnew(ft_strlen(s));
  	if (new == NULL)
  		return (NULL);
  	i = 0;
  	while (s[i] != '\0')
  	{
  		new[i] = f(i, s[i]);
  		i++;
  	}
  	return (new);
  }
  