Adding the libft
This commit is contained in:
parent
1b98b537b7
commit
c947e43e51
62 changed files with 2098 additions and 19 deletions
26
libft/char/ft_isalnum.c
Normal file
26
libft/char/ft_isalnum.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isalnum.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 12:47:28 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:54:42 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief Check if the character is alpha-numeric
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character if alphanumeric or 0 if not
|
||||
*/
|
||||
int ft_isalnum(int c)
|
||||
{
|
||||
if (ft_isalpha(c) || ft_isdigit(c))
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
26
libft/char/ft_isalpha.c
Normal file
26
libft/char/ft_isalpha.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isalpha.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 11:58:37 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:54:40 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief Check if the character is alpha
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character if alpha or 0 if not
|
||||
*/
|
||||
int ft_isalpha(int c)
|
||||
{
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
28
libft/char/ft_isascii.c
Normal file
28
libft/char/ft_isascii.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isascii.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 14:04:26 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:49:55 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief Check if the character is in the ascii table
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character if in the ascii table or 0 if not
|
||||
*/
|
||||
int ft_isascii(int c)
|
||||
{
|
||||
if (c == 0)
|
||||
return (1);
|
||||
if (c > 0 && c <= 127)
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
26
libft/char/ft_isdigit.c
Normal file
26
libft/char/ft_isdigit.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isdigit.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 12:44:28 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:49:05 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief Check if the character is alpha numeric
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character if numeric or 0 if not
|
||||
*/
|
||||
int ft_isdigit(int c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
26
libft/char/ft_isprint.c
Normal file
26
libft/char/ft_isprint.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isprint.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/06 14:06:53 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:50:37 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief Check if the character is printable
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character if can be print or 0 if not
|
||||
*/
|
||||
int ft_isprint(int c)
|
||||
{
|
||||
if (c >= 32 && c <= 126)
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
26
libft/char/ft_tolower.c
Normal file
26
libft/char/ft_tolower.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_tolower.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/07 10:38:54 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:55:28 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief convert the upper case to lower case
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character to lower case if is on upper
|
||||
*/
|
||||
int ft_tolower(int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += 32;
|
||||
return (c);
|
||||
}
|
||||
26
libft/char/ft_toupper.c
Normal file
26
libft/char/ft_toupper.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_toupper.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/07 10:44:26 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 12:55:14 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* @brief convert the lower case to upper case
|
||||
*
|
||||
* @param c the character
|
||||
* @return the character to upper case if is on lower
|
||||
*/
|
||||
int ft_toupper(int c)
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
c -= 32;
|
||||
return (c);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue