--- /dev/null
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_remove_space.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2024/06/15 08:27:22 by ljiriste #+# #+# */
+/* Updated: 2024/06/15 08:36:48 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_str.h"
+#include "libft.h"
+#include <stdlib.h>
+
+// This function could be improved not to overallocate
+char *ft_remove_space(const char *str)
+{
+ char *res;
+ size_t i;
+ size_t j;
+
+ res = malloc(ft_strlen(str) + 1);
+ if (!res)
+ return (NULL);
+ i = 0;
+ j = 0;
+ while (str[i])
+ {
+ if (!ft_isspace(str[i]))
+ res[j++] = str[i];
+ ++i;
+ }
+ res[j] = '\0';
+ return (res);
+}
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/09 11:50:15 by ljiriste #+# #+# */
-/* Updated: 2024/05/02 11:23:35 by ljiriste ### ########.fr */
+/* Updated: 2024/06/15 08:34:22 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_substr(const char *s, unsigned int start, size_t len);
char *ft_strjoin(const char *s1, const char *s2);
char *ft_strtrim(const char *s1, const char *set);
+char *ft_remove_space(const char *str);
char **ft_split(const char *s, char c);
char *ft_strmapi(const char *s, char (*f)(unsigned int, char));
void ft_striteri(char *s, void (*f)(unsigned int, char *));