Skip to content

RIDWANE-EL-FILALI/libft

Repository files navigation

your very own library recreated to help you in your cursus in 1337 you'll recreate some useful functions in the standard library

Resources

C standard library

C Library <ctype.h>

Libft Description
ft_isalnum Checks whether the passed character is alphanumeric.
ft_isalpha Checks whether the passed character is alphabetic.
ft_isascii Checks whether the passed character is ASCII.
ft_isdigit Checks whether the passed character is decimal digit.
ft_isprint Checks whether the passed character is printable.
ft_tolower Converts uppercase letters to lowercase.
ft_toupper Converts lowercase letters to uppercase.

C Library <string.h>

Libft Description
ft_bzero Erases the data in the n bytes of the memory block. (Write zeroes)
ft_memchr Searches for the first occurrence of the character c (an unsigned char) in the first n bytes of the string.
ft_memcmp Compares the first n bytes of str1 and str2.
ft_memcpy Copies n characters from src to dest.
ft_memmove Copies n characters from src to dest. (Non destructive manner)
ft_memset Copies the character c (an unsigned char) to the first n characters of the string.
ft_strchr Searches for the first occurrence of the character c (an unsigned char) in the string.
ft_strlcat Appends string src to the end of dst. It will append at most dstsize - strlen(dst) - 1 characters.
ft_strlcpy Copies up to dstsize - 1 characters from the string src to dst.
ft_strlen Computes the length of the string but not including the terminating null character.
ft_strncmp Compares at most the first n bytes of str1 and str2.
ft_strnstr Locates the first occurrence of the null-terminated string little in the string big, where not more than len characters are searched.
ft_strrchr Searches for the last occurrence of the character c (an unsigned char) in the string.

C Library <stdlib.h>

Libft Description
ft_atoi Converts the string to an integer (type int).
ft_calloc Allocates the requested memory initialized to zero bytes.

Non-stantard C Library

Libft Description
ft_itoa Converts the int to a string (type char *).
ft_putchar_fd Outputs the character 'c' to the given file descriptor.
ft_putendl_fd Outputs the string 's' to the given file descriptor, followed by a newline.
ft_putnbr_fd Outputs the integer 'n' to the given file descriptor.
ft_putstr_fd Outputs the string 's' to the given file descriptor.
ft_strdup Returns a pointer to a null-terminated byte string, which is a duplicate of the string.
ft_striteri Applies a function to each character of the string.
ft_strjoin Returns a new string, which is the result of the concatenation of 's1' and 's2'.
ft_strmapi Applies a function to each character of the string 's' to create a new string.
ft_strtrim Returns a copy of 's1' with the characters specified in 'set' removed from the beginning and the end of the string.
ft_substr Returns a substring from the string 's'. The substring begins at index 'start' and is of maximum size 'len'.

Chained lists manipulation

Libft Description
ft_lstadd_back Adds the element at the end of the list.
ft_lstadd_front Adds the element at the beginning of the list.
ft_lstclear Deletes and frees the given element and every successor of that element, using a given function and free.
ft_lstdelone Takes as a parameter an element and frees the memory of the element’s content using a function given as a parameter and free the element.
ft_lstiter Iterates the list and applies a function to the content of each element.
ft_lstlast Returns the last element of the list.
ft_lstmap Iterates the list and applies a function to the content of each element. Creates a new list resulting of the successive applications of the function. A 'del' function is used to delete the content of an element if needed.
ft_lstnew Returns a new element.
ft_lstsize Counts the number of elements in a list.

Made by RIDWANE EL FILALI 👋 See my linkedin