42_cube3D/libftx/extra/ft_contain_only.c
2023-05-03 11:11:04 +00: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/04/26 13:07:06 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
int ft_contain_only(const 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(const char *str, const 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);
}