Skip to content

Commit 628c90b

Browse files
author
Loic Lord
committed
added isspace
1 parent a103767 commit 628c90b

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# By: llord <llord@student.42.fr> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2021/09/22 12:48:17 by llord #+# #+# #
9-
# Updated: 2023/03/30 11:45:30 by llord ### ########.fr #
9+
# Updated: 2023/04/07 10:24:03 by llord ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

@@ -96,7 +96,7 @@ FTFD_DIR = ft_fd/
9696
FTFD = ft_putchar_fd ft_putendl_fd ft_putnbr_fd ft_putstr_fd
9797

9898
FTIS_DIR = ft_is/
99-
FTIS = ft_isalnum ft_isalpha ft_isascii ft_isdigit ft_isprint
99+
FTIS = ft_isalnum ft_isalpha ft_isascii ft_isdigit ft_isprint ft_isspace
100100

101101
FTLST_DIR = ft_lst/
102102
FTLST = ft_lstadd_back ft_lstadd_front ft_lstclear ft_lstdelone \

ft_is/ft_isspace.c

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* ************************************************************************** */
2+
/* */
3+
/* ::: :::::::: */
4+
/* ft_isspace.c :+: :+: :+: */
5+
/* +:+ +:+ +:+ */
6+
/* By: llord <llord@student.42.fr> +#+ +:+ +#+ */
7+
/* +#+#+#+#+#+ +#+ */
8+
/* Created: 2023/04/07 10:23:25 by llord #+# #+# */
9+
/* Updated: 2023/04/07 10:25:08 by llord ### ########.fr */
10+
/* */
11+
/* ************************************************************************** */
12+
13+
#include "libft.h"
14+
15+
//checks is a char is a whitespace
16+
int ft_isspace(int c)
17+
{
18+
if (c == 32)
19+
return (1);
20+
if (9 <= c && c <= 13)
21+
return (2);
22+
return (0);
23+
}

libft.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: llord <llord@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2022/03/28 14:20:01 by llord #+# #+# */
9-
/* Updated: 2023/03/30 10:54:34 by llord ### ########.fr */
9+
/* Updated: 2023/04/07 10:23:47 by llord ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -33,6 +33,7 @@ int ft_isalnum(int c);
3333
int ft_isalpha(int c);
3434
int ft_isascii(int c);
3535
int ft_isprint(int c);
36+
int ft_isspace(int c);
3637

3738
t_list *ft_lstnew(void *content);
3839
void ft_lstadd_front(t_list **lst, t_list *new);

0 commit comments

Comments
 (0)