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

Go to the source code of this file.

Functions

char * ft_strtrim (char const *s)
 Trims whitespace from the start and end of a string. More...
 

Function Documentation

◆ ft_strtrim()

char* ft_strtrim ( char const *  s)

Trims whitespace from the start and end of a string.

Allocates (with malloc) and returns a copy of the string given as argument without whitespaces at the beginning or at the end of the string. Will be considered as whitespaces the following characters ' ', '\n' and '\t'. If s has no whitespaces at the beginning or at the end, the function returns a copy of s.

Parameters
sThe string to be trimmed.
Returns
The “fresh” trimmed string or a copy of s or NULL if allocation failed.

Definition at line 34 of file ft_strtrim.c.