-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_isstrset.c
52 lines (48 loc) · 1.7 KB
/
ft_isstrset.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isstrset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/09 10:42:10 by akharrou #+# #+# */
/* Updated: 2019/05/20 10:17:58 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
/*
** NAME
** ft_isstrset -- search for string in string table
**
** SYNOPSIS
** #include <libft.h>
**
** int
** ft_isstrset(const char *str, const char **strset);
**
** PARAMETERS
**
** const char *str String to look for in the string set.
**
** const char **strset String table in which to look for 'str'.
**
** DESCRIPTION
** Iterates through every string in the string set provided looking
** for 'str'.
**
** RETURN VALUES
** If 'str' is found, returns 1; otherwise 0.
*/
#include "../Includes/string_42.h"
#include "../Includes/stdint_42.h"
int ft_isstrset(const char *str, const char **strset)
{
int8_t i;
if (strset && str)
{
i = -1;
while (strset[++i])
if (ft_strcmp(strset[i], str) == 0)
return (1);
}
return (0);
}