Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft

Libft is a custom library in C that replicates several standard C library functions, as well as additional helper functions and data structures. The goal is to create foundational functions that provide essential operations for character manipulation, memory management, string operations, and linked list manipulation.

Table of Contents

  1. Standard C Library Replications
  2. Memory Allocation Functions
  3. Additional Functions
  4. Bonus Linked List Functions
  5. How to use?

Standard C Library Replications

This section contains functions that replicate the behavior of standard C library functions. They provide functionality to handle characters, strings, and memory operations.

Character Checks

  • ft_isalpha - Checks if a character is alphabetic.
  • ft_isdigit - Checks if a character is a digit.
  • ft_isalnum - Checks if a character is alphanumeric.
  • ft_isascii - Checks if a character is in the ASCII range.
  • ft_isprint - Checks if a character is printable.

String and Character Operations

  • ft_strlen - Returns the length of a string.
  • ft_strchr - Locates the first occurrence of a character in a string.
  • ft_strrchr - Locates the last occurrence of a character in a string.
  • ft_strncmp - Compares up to n characters of two strings.
  • ft_strnstr - Locates a substring in a string up to n characters.
  • ft_toupper - Converts a lowercase letter to uppercase.
  • ft_tolower - Converts an uppercase letter to lowercase.

Memory Operations

  • ft_memset - Fills memory with a constant byte.
  • ft_bzero - Writes zeroes to a byte string.
  • ft_memcpy - Copies n bytes from one memory area to another.
  • ft_memmove - Copies n bytes from one memory area to another (handles overlap).
  • ft_memchr - Locates a byte in a memory area.
  • ft_memcmp - Compares n bytes of two memory areas.

String Size Manipulation

  • ft_strlcpy - Copies up to size - 1 characters to a string, null-terminated.
  • ft_strlcat - Appends a string to another, up to size - 1 characters, null-terminated.

Conversion

  • ft_atoi - Converts a string to an integer.

Memory Allocation Functions

These functions utilize malloc() for dynamic memory allocation.

  • ft_calloc - Allocates and initializes memory to zero for an array of nmemb elements of size.
  • ft_strdup - Duplicates a string by allocating memory and copying the contents of the string.

Additional Functions

These functions extend the capabilities of libft by offering more string and character operations, output functions, and other utilities.

File Descriptor Output

  • ft_putchar_fd - Writes a character to a specified file descriptor.
  • ft_putstr_fd - Writes a string to a specified file descriptor.
  • ft_putendl_fd - Writes a string followed by a newline to a specified file descriptor.
  • ft_putnbr_fd - Writes an integer to a specified file descriptor.

String Manipulation

  • ft_itoa - Converts an integer to a string.
  • ft_strmapi - Creates a new string by applying a function to each character of an existing string.
  • ft_striteri - Applies a function to each character of a string, with the character's index as an argument.
  • ft_substr - Returns a substring starting at a specified index for a given length.
  • ft_strjoin - Concatenates two strings into a new string.
  • ft_strtrim - Trims specified characters from the start and end of a string.
  • ft_split - Splits a string into an array of strings based on a delimiter.

Bonus Linked List Functions

The following functions are used to create and manipulate linked lists. Each function is crafted to perform specific linked list operations.

Basic Linked List Operations

  • ft_lstnew - Creates a new list element.
  • ft_lstadd_front - Adds an element to the beginning of a list.
  • ft_lstsize - Counts the number of elements in a list.
  • ft_lstlast - Returns the last element of a list.
  • ft_lstadd_back - Adds an element to the end of a list.

Advanced Linked List Manipulations

  • ft_lstdelone - Deletes a list element using a function to free the content.
  • ft_lstclear - Deletes and frees all elements in a list.
  • ft_lstiter - Iterates over a list and applies a function to each element.
  • ft_lstmap - Creates a new list by applying a function to each element of an existing list.

Utility

  • ft_strncpy - Copies a specified number of characters from one string to another.

How to use?

To use libft, compile the library and link it to your project:

  1. Clone the repository and navigate to the directory.
  2. Run make to compile libft.a.
  3. Include libft.h in your project files with #include "libft.h" to access function declarations.
  4. If needed, copy the compiled libft.a file into other projects or link it during compilation to use the library.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages