gnl integre au main

This commit is contained in:
hugogogo
2021-07-24 11:57:54 +02:00
parent 0c4e4419c7
commit 0bf59a09b9
192 changed files with 6157 additions and 10 deletions

32
libftt/srcs/ft_strmap.c Normal file
View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/14 21:17:49 by hulamy #+# #+# */
/* Updated: 2019/03/25 15:23:12 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** create a new array with the result of function f on every element of s
*/
#include "libft.h"
char *ft_strmap(char const *s, char (*f)(char))
{
char *str;
int i;
if (!s)
return (NULL);
if (!(str = ft_strnew(ft_strlen(s))))
return (NULL);
i = -1;
while (s[++i])
str[i] = f(s[i]);
return (str);
}