-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strmap.c
More file actions
29 lines (26 loc) · 1.13 KB
/
Copy pathft_strmap.c
File metadata and controls
29 lines (26 loc) · 1.13 KB
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: tparand <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/10 16:45:33 by tparand #+# #+# */
/* Updated: 2017/11/13 22:12:15 by tparand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strmap(char const *s, char (*f)(char))
{
char *new;
char *p_new;
if (s == NULL)
return (NULL);
new = ft_strnew(ft_strlen(s));
if (!new)
return (NULL);
p_new = new;
while (*s != '\0')
*new++ = f(*s++);
return (p_new);
}