minishell
Minishell Project for École 42
|
Functions for cleaning the input string by removing leading and trailing whitespaces. More...
#include "minishell.h"
Functions | |
int | ft_isspace (int c) |
Checks if the given character is a whitespace. | |
char * | replace_with_clean (char *rl_copy, size_t start, size_t end) |
Removes characters from a string that are before and after a given index. | |
char * | clean_rl_copy (char *rl_copy) |
Create a copy of the input string with its leading and trailing whitespaces removed. | |
Functions for cleaning the input string by removing leading and trailing whitespaces.
char * clean_rl_copy | ( | char * | rl_copy | ) |
Create a copy of the input string with its leading and trailing whitespaces removed.
Removes leading and trailing whitespaces from rl_copy and creates a new string with these whitespaces removed. The original input string is freed.
rl_copy | The input string to be cleaned. |
int ft_isspace | ( | int | c | ) |
Checks if the given character is a whitespace.
Checks if a given character is a whitespace and returns 1 if it is. Otherwise returns 0.
c | The character to check. |
char * replace_with_clean | ( | char * | rl_copy, |
size_t | start, | ||
size_t | end | ||
) |
Removes characters from a string that are before and after a given index.
Creates a new string containing characters from the input string (rl_copy) starting from the 'start' index up to the 'end' index. If allocation fails, a error message is displayed and NULL is returned.
rl_copy | The input string. |
start | The starting index. |
end | The ending index. |