diff --git a/libftasm/includes/str.h b/libftasm/includes/str.h index 2c95ad51..eeadb792 100644 --- a/libftasm/includes/str.h +++ b/libftasm/includes/str.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/18 13:05:53 by jhalford #+# #+# */ -/* Updated: 2017/02/18 18:47:45 by jhalford ### ########.fr */ +/* Updated: 2017/03/02 15:14:08 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,5 +66,6 @@ char *ft_strtok(char *s, const char *delim); size_t ft_strcspn(char *s, const char *delim); char *ft_path_notdir(char *path); +int ft_stris(char *str, (*f)(char *str)); #endif diff --git a/libftasm/src/str/ft_stris.c b/libftasm/src/str/ft_stris.c new file mode 100644 index 00000000..22d478e0 --- /dev/null +++ b/libftasm/src/str/ft_stris.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_stris.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: ariard +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/03/02 15:11:28 by ariard #+# #+# */ +/* Updated: 2017/03/02 15:13:07 by ariard ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_stris(char *str, (*f)(char *str)) +{ + while (*str) + if (!(f)(*str++)) + return (0); + return (1); +}