/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strmapi.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: scebula +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/11/26 10:48:03 by scebula #+# #+# */ /* Updated: 2015/11/26 10:51:51 by scebula ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) { char *str; unsigned int i; str = ft_strnew(ft_strlen(s)); if (str == NULL) return (NULL); i = 0; while (s[i]) { str[i] = f(i, s[i]); i++; } return (str); }