This commit is contained in:
null
2025-08-04 13:20:27 +02:00
commit d215954dec
43 changed files with 1931 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmapi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/23 11:52:03 by hexplor #+# #+# */
/* Updated: 2023/11/30 09:04:01 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strmapi(char const *s, char (*f)(unsigned int, char))
{
unsigned int i;
char *str;
i = 0;
str = ft_calloc((ft_strlen(s) + 1), 1);
if (!str)
return (0);
while (*(s + i))
{
*(str + i) = f(i, *(s + i));
i++;
}
*(str + i) = '\0';
return (str);
}