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_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/15 16:49:13 by adjoly #+# #+# */
/* Updated: 2023/07/17 11:15:40 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i])
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}

View File

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/15 16:49:13 by adjoly #+# #+# */
/* Updated: 2023/07/17 22:41:12 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (i < n && src[i])
{
dest[i] = src[i];
i++;
}
while (i < n)
{
dest[i] = '\0';
i++;
}
return (dest);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:06:22 by adjoly #+# #+# */
/* Updated: 2023/07/17 17:16:02 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
int i;
i = 0;
while (str[i])
{
if ((str[i] < 65 || str[i] > 90) && (str[i] < 97 || str[i] > 122))
return (0);
i++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:06:22 by adjoly #+# #+# */
/* Updated: 2023/07/17 17:53:00 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] < '0' || str[i] > '9')
return (0);
i++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:06:22 by adjoly #+# #+# */
/* Updated: 2023/07/17 17:19:30 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] < 97 || str[i] > 122)
return (0);
i++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:06:22 by adjoly #+# #+# */
/* Updated: 2023/07/17 17:58:53 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] < 65 || str[i] > 90)
return (0);
i++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:06:22 by adjoly #+# #+# */
/* Updated: 2023/07/17 17:51:25 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] < 32 || str[i] == 127)
return (0);
i++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 17:50:51 by adjoly #+# #+# */
/* Updated: 2023/07/19 22:09:15 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 97 && str[i] <= 122)
str[i] -= 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 17:50:51 by adjoly #+# #+# */
/* Updated: 2023/07/20 09:37:24 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 65 && str[i] <= 90)
str[i] = str[i] + 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 18:12:38 by adjoly #+# #+# */
/* Updated: 2023/07/18 21:24:58 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcapitalize(char *str)
{
int i;
i = 0;
if (str[i] >= 'a' && str[i] <= 'z')
str[i] -= 32;
i++;
while (str[i])
{
if ((str[i] >= 'a' && str[i] <= 'z')
&& !((str[i - 1] >= '0' && str[i - 1] <= '9')
|| (str[i - 1] >= 'a' && str[i - 1] <= 'z')
|| (str[i - 1] >= 'A' && str[i - 1] <= 'Z')))
str[i] -= 32;
else if (str[i] >= 'A' && str[i] <= 'Z'
&& ((str[i - 1] >= '0' && str[i - 1] <= '9')
|| (str[i - 1] >= 'a' && str[i - 1] <= 'z')
|| (str[i - 1] >= 'A' && str[i - 1] <= 'Z')))
str[i] += 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/18 13:39:08 by adjoly #+# #+# */
/* Updated: 2023/07/18 19:49:31 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i;
i = 0;
if (size == 0)
{
while (src[i])
i++;
return (i);
}
while (src[i] && i + 1 < size)
{
dest[i] = src[i];
i++;
}
while (i < size)
{
dest[i] = '\0';
i++;
}
i = 0;
while (src[i])
i++;
return (i);
}