-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strmap.c
29 lines (26 loc) · 1.09 KB
/
ft_strmap.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rodrodri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/06 15:59:26 by rodrodri #+# #+# */
/* Updated: 2021/11/14 22:21:35 by rodrodri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strmap(char const *s, char (*f)(char))
{
char *m;
char *p;
if (!s)
return (NULL);
m = ft_strnew(ft_strlen(s));
if (!m)
return (NULL);
p = m;
while (*s)
*m++ = f(*s++);
return (p);
}