files dans srcs sans dossier

This commit is contained in:
Hugo LAMY
2020-02-10 10:25:04 +01:00
parent e9c7619e97
commit 52eaaddb0d
76 changed files with 10 additions and 12 deletions

32
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);
}