1
0

first commit

This commit is contained in:
Adam Joly
2023-08-03 23:16:27 +02:00
parent 7f3254f1c5
commit a80c4d61d7
133 changed files with 4293 additions and 0 deletions

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 16:20:57 by adjoly #+# #+# */
/* Updated: 2023/07/25 13:06:36 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] || s2[i])
{
if (s1[i] != s2[i])
return (s1[i] - s2[i]);
i++;
}
return (s1[i] - s2[i]);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 16:20:57 by adjoly #+# #+# */
/* Updated: 2023/07/25 13:07:01 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
unsigned int i;
i = 0;
while ((s1[i] || s2[i]) && i < n)
{
if (s1[i] != s2[i])
return (s1[i] - s2[i]);
i++;
}
return (0);
}

View File

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 17:17:04 by adjoly #+# #+# */
/* Updated: 2023/07/18 17:33:22 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
char *ft_strcat(char *dest, char *src)
{
int size_dest;
unsigned int i;
i = 0;
size_dest = ft_strlen(dest);
while (src[i])
{
dest[size_dest + i] = src[i];
i++;
}
dest[size_dest + i] = '\0';
return (dest);
}

View File

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 17:17:04 by adjoly #+# #+# */
/* Updated: 2023/07/18 17:32:47 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
int size_dest;
unsigned int i;
i = 0;
size_dest = ft_strlen(dest);
while (src[i] && i < nb)
{
dest[size_dest + i] = src[i];
i++;
}
dest[size_dest + i] = '\0';
return (dest);
}

View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 21:31:36 by adjoly #+# #+# */
/* Updated: 2023/07/20 22:14:23 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strstr(char *str, char *to_find)
{
int i;
int j;
i = 0;
j = 0;
if (to_find[0] == '\0')
{
return (str);
}
while (str[i])
{
while (str[i + j] == to_find[j])
{
if (to_find[j + 1] == '\0')
return (&str[i]);
j++;
}
j = 0;
i++;
}
return (0);
}