-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_startswith.c
23 lines (20 loc) · 1.12 KB
/
ft_startswith.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_startswith.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tairribe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/13 21:25:45 by tairribe #+# #+# */
/* Updated: 2024/03/13 21:29:45 by tairribe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_bool ft_startswith(const char *str, const char *prefix) {
size_t prefix_len;
prefix_len = ft_strlen(prefix);
if (prefix_len > ft_strlen(str)){
return (false);
}
return (ft_strncmp(str, prefix, prefix_len) == 0);
}