juwkim / libft

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🧰 libft

Your very first own library

GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


💡 About the project

This project is about coding a C library. It will contain a lot of general purpose functions your programs will rely upon.

C Programming can be very tedious when one doesn't have access to the highly useful standard functions.
This project is about understanding the way these functions work, implementing and learning to use them.
You will create your own library. It will be helpful since you will use it in your next C school assignments.

Take the time to expand your libft throughout the year. However, when working on a new project, don't forget to
ensure the functions used in your library are allowed in the project guidelines.

For more detailed information, look at the subject of this project.

List of functions:

Functions from <ft_ctype.h> library

  • ft_isupper - Checks for an uppercase character.
  • ft_islower - Checks for a lowercase character.
  • ft_isalpha - Checks for an alphabetic character. It is equivalent to (isupper(c) || islower(c)).
  • ft_isdigit - Checks for a digit (0 through 9).
  • ft_isxdigit - Checks for hexadecimal digits. That is, one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F.
  • ft_isspace - Checks for white-space characters.
  • ft_isprint - Checks for any printable character including space.
  • ft_isgraph - Checks for any printable character except space.
  • ft_isblank - Checks for a blank character. That is, a space or a tab.
  • ft_iscntrl - Checks for a control character.
  • ft_ispunct - Checks for a character is a punctuation. All punctuations in c: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~.
  • ft_isalnum - Checks for an alphanumeric character. It is equivalent to (isalpha(c) || isdigit(c)).
  • ft_isascii - Checks whether c is a 7-bit unsigned char value that fits into the ASCII character set.
  • ft_toupper - Lower case to upper case character conversion.
  • ft_tolower - Upper case to lower case character conversion.

Functions from <ft_math.h> library

Functions from <ft_stdio.h> library

Functions from <ft_stdlib.h> library

  • ft_abs - Returns the absolute value.
  • ft_atoi - Converts the initial portion of the string to int.
  • ft_itoa - Converts an integer to ASCII string.
  • ft_calloc - Allocates memory set to zero.

Functions from <ft_string.h> library

  • ft_memcmp - Compares the first n bytes (each interpreted as unsigned char) of the memory areas.
  • ft_memcpy - Copies n bytes from memory area src to memory area dest. The memory areas must not overlap.
  • ft_memset - Fills the first n bytes of the memory area with the constant byte c.
  • ft_strlen - Calculates the length of the string.
  • ft_strcat - Appends the src string to the dest string.
  • ft_strncat - Appends the src string to the dest string at most n bytes.
  • ft_strchr - Find the first occurrence of the character c in the string.
  • ft_strrchr - Find the last occurrence of the character c in the string.
  • ft_strcmp - Compares the two strings.
  • ft_strncmp - Compares the two strings at most n bytes.
  • ft_strcpy - Copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest.
  • ft_strncpy - Copies the string pointed to by src at most n bytes, including the terminating null byte ('\0'), to the buffer pointed to by dest.
  • ft_strdup - Copy the string.
  • ft_strndup - Copy the string at most n bytes.
  • ft_strstr - Finds the first occurrence of the substring needle in the string haystack.

Functions from <ft_strings.h> library

  • ft_bzero - Write zeroes to a byte string.
  • ft_split - Split string with delimiter into an array of strings.
  • ft_strrev - Reverse the string s.
  • ft_strtok - Breaks a string into a sequence of zero or more nonempty tokens.
  • ft_strtrim - Removes the space before and after of the string.
  • ft_strjoin - Concatenate two strings into a new string.
  • ft_strcjoin - Concatenate two strings with c between them.

🛠️ Usage

Requirements

The library is written in C language and thus needs the C compiler and some standard C libraries to run.

Instructions

  • Pull files ↙️
$ git clone https://github.com/juwkim/libft
  • To build libft ↙️
$ make
  • To clean all object files (.o) and library file (.a) ↙️
$ make fclean
  • To check this repository complies with norminette ↙️
$ make norm
  • To use libft in your code ↙️
#include "libft.h"

About

License:MIT License


Languages

Language:C 94.9%Language:Makefile 5.1%