42_solong/libftx/extra/ft_contain_only.c
Camille Chauvet 1088942133 kekw
2023-01-13 15:10:27 +01:00

42 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_contain_only.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/12 16:28:20 by cchauvet #+# #+# */
/* Updated: 2023/01/12 16:31:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
int ft_contain_only(char *str, char c)
{
size_t i;
i = 0;
while (str[i] != '\0')
{
if (str[i] != c)
return (0);
i++;
}
return (1);
}
int ft_contain_only_str(char *str, char *to_find)
{
size_t i;
i = 0;
while (str[i] != '\0')
{
if (!ft_is_in(to_find, str[i]))
return (0);
i++;
}
return (1);
}