1
0

first commit

This commit is contained in:
KeyZox
2023-08-06 20:12:38 +02:00
parent 1fe062c970
commit eb6b113e51
125 changed files with 2987 additions and 0 deletions

View File

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 16:55:23 by ajoly #+# #+# */
/* Updated: 2022/07/20 16:55:30 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
{
i++;
}
return (s1[i] - s2[i]);
}

View File

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/21 10:14:08 by ajoly #+# #+# */
/* Updated: 2022/07/21 10:14:11 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
unsigned int i;
i = 0;
if (n == 0)
{
return (0);
}
while (s1[i] == s2[i] && i + 1 < n && s1[i] != '\0' && s2[i] != '\0')
{
i++;
}
return (s1[i] - s2[i]);
}

View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/21 15:08:59 by ajoly #+# #+# */
/* Updated: 2022/07/21 15:11:10 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcat(char *dest, char *src)
{
int i;
int l;
i = 0;
l = 0;
while (dest[i] != '\0')
{
i++;
}
while (src[l] != '\0')
{
dest[i] = src[l];
i++;
l++;
}
dest[i] = '\0';
return (dest);
}

View File

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/22 09:49:37 by ajoly #+# #+# */
/* Updated: 2022/07/22 09:49:45 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
unsigned int i;
unsigned int l;
i = 0;
l = 0;
while (dest[i] != '\0')
{
i++;
}
while (src[l] != '\0' && l < nb)
{
dest[i + l] = src[l];
l++;
}
dest[i + l] = '\0';
return (dest);
}

View File

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/25 10:18:22 by ajoly #+# #+# */
/* Updated: 2022/07/25 10:18:26 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <stddef.h>
char *ft_strstr(char *str, char *to_find)
{
int i;
int j;
char *l[255];
i = 0;
j = 0;
if (str == 0)
{
return (NULL);
}
while (str[i] != '\0')
{
if (str[i] == to_find[j])
{
str[j] = to_find[j];
j++;
}
i++;
}
l[i] = '\0';
return (*str);
}