der des der des der
This commit is contained in:
parent
6ee4c3dd87
commit
9a3da40a5c
2
Makefile
2
Makefile
|
@ -6,7 +6,7 @@
|
||||||
# By: erey-bet <marvin@42.fr> +#+ +:+ +#+ #
|
# By: erey-bet <marvin@42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2022/09/27 04:19:30 by erey-bet #+# #+# #
|
# Created: 2022/09/27 04:19:30 by erey-bet #+# #+# #
|
||||||
# Updated: 2022/10/15 15:06:59 by erey-bet ### ########.fr #
|
# Updated: 2022/10/19 17:45:46 by erey-bet ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
13
ft_strtrim.c
13
ft_strtrim.c
|
@ -24,8 +24,11 @@ static int get_start(const char *str, char const *set)
|
||||||
y = 0;
|
y = 0;
|
||||||
check = 0;
|
check = 0;
|
||||||
while (set[y])
|
while (set[y])
|
||||||
if (str[i] == set[y++])
|
{
|
||||||
|
if (str[i] == set[y])
|
||||||
check = 1;
|
check = 1;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
if (check == 0)
|
if (check == 0)
|
||||||
return (i);
|
return (i);
|
||||||
i++;
|
i++;
|
||||||
|
@ -45,8 +48,11 @@ static int get_end(const char *str, char const *set)
|
||||||
y = 0;
|
y = 0;
|
||||||
check = 0;
|
check = 0;
|
||||||
while (set[y])
|
while (set[y])
|
||||||
if (str[i] == set[y++])
|
{
|
||||||
|
if (str[i] == set[y])
|
||||||
check = 1;
|
check = 1;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
if (check == 0)
|
if (check == 0)
|
||||||
return (i + 1);
|
return (i + 1);
|
||||||
i--;
|
i--;
|
||||||
|
@ -71,7 +77,8 @@ char *ft_strtrim(char const *s1, char const *set)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (start < end)
|
while (start < end)
|
||||||
{
|
{
|
||||||
str[i++] = s1[start];
|
str[i] = s1[start];
|
||||||
|
i++;
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
str[i] = '\0';
|
str[i] = '\0';
|
||||||
|
|
Loading…
Reference in a new issue