From d76fa9350d07e61e0b2524a411e8aca5151381e4 Mon Sep 17 00:00:00 2001 From: whaffman Date: Wed, 5 Feb 2025 12:45:16 +0100 Subject: [PATCH] ft_ispace.c --- Makefile | 16 ++++++++-------- inc/libft.h | 16 +++++++++------- src/conversion/ft_atoi.c | 20 +++++++------------- src/string/ft_isspace.c | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 src/string/ft_isspace.c diff --git a/Makefile b/Makefile index 9fb1db4..7628f53 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ # **************************************************************************** # # # -# ::: o_ :::::: ::: # -# Makefile :+: / :+::+: :+: # -# +:+ > +:++:+ +:+ # -# By: whaffman +#+ +:+ +#++#++:++#++ # -# +#+ +#+#+ +#++#+ +#+ \o/ # -# Created: 2024/10/10 16:44:36 by whaffman #+#+# #+#+# #+# #+# | # -# Updated: 2024/10/10 18:00:05 by whaffman ### ### ### ### / \ # +# :::::::: # +# Makefile :+: :+: # +# +:+ # +# By: whaffman +#+ # +# +#+ # +# Created: 2024/10/10 16:44:36 by whaffman #+# #+# # +# Updated: 2025/02/05 12:43:55 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -34,7 +34,7 @@ SRC_STRING = ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c ft_isprint.c \ ft_split.c ft_strchr.c ft_strdup.c ft_striteri.c ft_strjoin.c \ ft_strlcat.c ft_strlcpy.c ft_strlen.c ft_strmapi.c ft_strncmp.c \ ft_strnstr.c ft_strrchr.c ft_strtrim.c ft_substr.c ft_strcmp.c \ - ft_count_words.c + ft_count_words.c ft_isspace.c SRC_LIST = ft_lstadd_back.c ft_lstadd_front.c ft_lstclear.c ft_lstdelone.c \ ft_lstiter.c ft_lstlast.c ft_lstmap.c ft_lstnew.c ft_lstsize.c diff --git a/inc/libft.h b/inc/libft.h index bfa0e68..dea3d0d 100644 --- a/inc/libft.h +++ b/inc/libft.h @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* ::: :::::::: */ -/* libft.h :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: whaffman +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/07/06 11:15:10 by whaffman #+# #+# */ -/* Updated: 2024/07/10 16:27:58 by whaffman ### ########.fr */ +/* :::::::: */ +/* libft.h :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2024/07/06 11:15:10 by whaffman #+# #+# */ +/* Updated: 2025/02/05 12:38:44 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -25,6 +25,8 @@ int ft_isdigit(int c); int ft_isalnum(int c); int ft_isascii(int c); int ft_isprint(int c); +int ft_isspace(const char c); + int ft_count_words(char const *s, char c); size_t ft_strlen(const char *s); void *ft_memset(void *s, int c, size_t n); diff --git a/src/conversion/ft_atoi.c b/src/conversion/ft_atoi.c index 14d9ecc..5709113 100644 --- a/src/conversion/ft_atoi.c +++ b/src/conversion/ft_atoi.c @@ -1,23 +1,17 @@ /* ************************************************************************** */ /* */ -/* ::: o_ :::::: ::: */ -/* ft_atoi.c :+: / :+::+: :+: */ -/* +:+ > +:++:+ +:+ */ -/* By: whaffman +#+ +:+ +#++#++:++#++ */ -/* +#+ +#+#+ +#++#+ +#+ \o/ */ -/* Created: 2024/10/10 17:00:13 by whaffman #+#+# #+#+# #+# #+# | */ -/* Updated: 2024/10/10 17:00:13 by whaffman ### ### ### ### / \ */ +/* :::::::: */ +/* ft_atoi.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2024/10/10 17:00:13 by whaffman #+# #+# */ +/* Updated: 2025/02/05 12:41:14 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ #include "libft.h" -static int ft_isspace(int c) -{ - return (' ' == c || '\f' == c || \ - '\n' == c || '\r' == c || \ - '\t' == c || '\v' == c); -} int ft_atoi(const char *nptr) { diff --git a/src/string/ft_isspace.c b/src/string/ft_isspace.c new file mode 100644 index 0000000..1a9937e --- /dev/null +++ b/src/string/ft_isspace.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* ft_isspace.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/05 12:37:57 by whaffman #+# #+# */ +/* Updated: 2025/02/05 12:41:41 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ + +int ft_isspace(const char c) +{ + return (' ' == c || '\f' == c || \ + '\n' == c || '\r' == c || \ + '\t' == c || '\v' == c); +}