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

Go to the source code of this file.

Functions

char * ft_strmapi (char const *s, char(*f)(unsigned int, char))
 Maps a function to characters of a string and their indices Applies the function f to each character of the string passed as argument by giving its index as first argument to create a “fresh” new string (with malloc) resulting from the successive applications of f. More...
 

Function Documentation

◆ ft_strmapi()

char* ft_strmapi ( char const *  s,
char(*)(unsigned int, char)  f 
)

Maps a function to characters of a string and their indices Applies the function f to each character of the string passed as argument by giving its index as first 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 and its index of s.
Returns
The “fresh” string created from the successive applications of f, or NULL if allocation fails.

Definition at line 28 of file ft_strmapi.c.