ajout de strchrset
This commit is contained in:
1
Makefile
1
Makefile
@@ -30,6 +30,7 @@ SRCS = ft_memset.c \
|
||||
ft_tolower.c \
|
||||
ft_strchr.c \
|
||||
ft_strrchr.c \
|
||||
ft_strchrset.c \
|
||||
ft_strncmp.c \
|
||||
ft_strlcpy.c \
|
||||
ft_strlcat.c \
|
||||
|
||||
3
libft.h
3
libft.h
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:45:53 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/26 18:46:22 by hulamy ### ########.fr */
|
||||
/* Updated: 2020/02/16 15:10:37 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -33,6 +33,7 @@ int ft_toupper(int c);
|
||||
int ft_tolower(int c);
|
||||
char *ft_strchr(const char *s, int c);
|
||||
char *ft_strrchr(const char *s, int c);
|
||||
int ft_strchrset(char *s, char *set);
|
||||
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t size);
|
||||
size_t ft_strlcat(char *dst, const char *src, size_t size);
|
||||
|
||||
32
srcs/ft_strchrset.c
Normal file
32
srcs/ft_strchrset.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strchrset.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2020/02/16 15:07:11 by hulamy #+# #+# */
|
||||
/* Updated: 2020/02/16 15:12:03 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
** return 1 if any character of the character set is found in s
|
||||
** else return 0
|
||||
*/
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int ft_strchrset(char *s, char *set)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (set[i] != '\0')
|
||||
{
|
||||
if (ft_strchr(s, set[i]) != NULL)
|
||||
return (1);
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
Reference in New Issue
Block a user