aboutsummaryrefslogtreecommitdiff
path: root/src/str
diff options
context:
space:
mode:
Diffstat (limited to 'src/str')
-rw-r--r--src/str/ft_strcasecmp.c4
-rw-r--r--src/str/ft_strcspn.c23
-rw-r--r--src/str/ft_strncasecmp.c4
-rw-r--r--src/str/ft_strspn.c23
4 files changed, 50 insertions, 4 deletions
diff --git a/src/str/ft_strcasecmp.c b/src/str/ft_strcasecmp.c
index 45ba592..044e6de 100644
--- a/src/str/ft_strcasecmp.c
+++ b/src/str/ft_strcasecmp.c
@@ -6,14 +6,14 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/10 04:08:38 by cacharle #+# #+# */
-/* Updated: 2020/02/10 04:22:56 by cacharle ### ########.fr */
+/* Updated: 2020/02/10 04:31:33 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft_str.h"
#include "libft_types.h"
-int strcasecmp(const char *s1, const char *s2)
+int ft_strcasecmp(const char *s1, const char *s2)
{
while (*s1 && *s2 && ft_tolower(*s1) == ft_tolower(*s2))
{
diff --git a/src/str/ft_strcspn.c b/src/str/ft_strcspn.c
new file mode 100644
index 0000000..7cc06a5
--- /dev/null
+++ b/src/str/ft_strcspn.c
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strcspn.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/10 04:30:59 by cacharle #+# #+# */
+/* Updated: 2020/02/10 04:32:15 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_str.h"
+
+size_t ft_strcspn(const char *s, const char *charset)
+{
+ int i;
+
+ i = 0;
+ while (ft_strchr(charset, s[i]) == NULL)
+ i++;
+ return (i);
+}
diff --git a/src/str/ft_strncasecmp.c b/src/str/ft_strncasecmp.c
index 1b6308d..aafdc8c 100644
--- a/src/str/ft_strncasecmp.c
+++ b/src/str/ft_strncasecmp.c
@@ -6,14 +6,14 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/10 04:18:36 by cacharle #+# #+# */
-/* Updated: 2020/02/10 04:21:10 by cacharle ### ########.fr */
+/* Updated: 2020/02/10 04:31:38 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "libft_types.h"
-int strncasecmp(const char *s1, const char *s2, size_t n)
+int ft_strncasecmp(const char *s1, const char *s2, size_t n)
{
size_t i;
diff --git a/src/str/ft_strspn.c b/src/str/ft_strspn.c
new file mode 100644
index 0000000..81814e5
--- /dev/null
+++ b/src/str/ft_strspn.c
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strspn.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/10 04:29:13 by cacharle #+# #+# */
+/* Updated: 2020/02/10 04:33:11 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_str.h"
+
+size_t ft_strspn(const char *s, const char *charset)
+{
+ int i;
+
+ i = 0;
+ while (ft_strchr(charset, s[i]) != NULL)
+ i++;
+ return (i);
+}