maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_remove_quotes.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_remove_quotes.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: rocky <marvin@42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/09/26 18:12:43 by rocky #+# #+# */
9
/* Updated: 2024/09/26 18:12:45 by rocky ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
libft.h
"
14
15
char
*
ft_remove_quotes
(
char
*str,
char
quote_type)
16
{
17
int
len;
18
char
*new_str;
19
20
len =
ft_strlen
(str);
21
new_str = NULL;
22
if
(len > 1 && str[0] == quote_type && str[len - 1] == quote_type)
23
{
24
new_str =
ft_strndup
(str + 1, len - 2);
25
return
(new_str);
26
}
27
return
(
ft_strdup
(str));
28
}
ft_remove_quotes
char * ft_remove_quotes(char *str, char quote_type)
Definition
ft_remove_quotes.c:15
libft.h
ft_strndup
char * ft_strndup(const char *s, size_t n)
Definition
ft_strndup.c:23
ft_strlen
size_t ft_strlen(const char *s)
Definition
ft_strlen.c:15
ft_strdup
char * ft_strdup(const char *s)
Definition
ft_strdup.c:23
lib
libft
src
ft_remove_quotes.c
Generated by
1.9.8