libft
Functions
ft_strmap.c File Reference
#include "libft.h"
+ Include dependency graph for ft_strmap.c:

Go to the source code of this file.

Functions

char * ft_strmap (char const *s, char(*f)(char))
 Maps a function to characters of a string. More...
 

Function Documentation

◆ ft_strmap()

char* ft_strmap ( char const *  s,
char(*)(char)  f 
)

Maps a function to characters of a string.

Applies the function f to each character of the string given as argument to create a “fresh” new string (with malloc) resulting from the successive applications of f.

Parameters
sThe string to map.
fThe function to apply to each character of s.
Returns
The “fresh” string created from the successive applications of f, or NULL if allocation fails.

Definition at line 27 of file ft_strmap.c.