2023-02-15 14:52:27 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_quote_remover.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2023/02/15 14:12:00 by cchauvet #+# #+# */
|
2023-02-16 07:53:49 -05:00
|
|
|
/* Updated: 2023/02/16 13:20:50 by cchauvet ### ########.fr */
|
2023-02-15 14:52:27 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
char *ft_quote_remover(char *str)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
ssize_t start;
|
|
|
|
ssize_t stop;
|
|
|
|
|
|
|
|
start = -1;
|
|
|
|
i = 0;
|
|
|
|
while (str[i] != '\0')
|
|
|
|
{
|
|
|
|
if ((str[i] == '\"' || str[i] == '\''))
|
|
|
|
{
|
|
|
|
if (start == -1)
|
|
|
|
start = i;
|
|
|
|
else if (str[i] == str[start])
|
|
|
|
{
|
|
|
|
stop = i;
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (start != -1)
|
|
|
|
{
|
|
|
|
ft_strshift(str, -1);
|
2023-02-16 07:53:49 -05:00
|
|
|
ft_strshift(str + stop - 1, -1);
|
2023-02-15 14:52:27 -05:00
|
|
|
}
|
|
|
|
return (str);
|
|
|
|
}
|