text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strmapi.c                                       :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: szaghban <marvin@42.fr>                    +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2017/12/14 00:21:44 by szaghban          #+#    #+#             */
  /*   Updated: 2017/12/14 01:30:27 by szaghban         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
  {
  	char			*tmp;
  	unsigned int	i;
  
  	if (!s || !f)
  		return (NULL);
  	if (!(tmp = (char*)malloc((ft_strlen(s) + 1) * sizeof(char))))
  		return (NULL);
  	i = -1;
  	while (s[++i])
  		tmp[i] = f(i, s[i]);
  	tmp[i] = '\0';
  	return (tmp);
  }
  