libft
Loading...
Searching...
No Matches
Functions
ft_string.h File Reference

String manipulation utility functions. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char ** ft_split (const char *s, char c)
 Splits a string into substrings based on a delimiter character.
 
char ** ft_split_charset (char *s, char *charset)
 Splits a string into substrings based on a character set.
 
char * ft_strcat (char *dest, const char *src)
 Appends the src string to the end of the dest string.
 
char * ft_strchr (const char *str, int c)
 Finds the first occurrence of a character in a string.
 
int ft_strcmp (const char *s1, const char *s2)
 Compares two strings lexicographically.
 
char * ft_strcpy (char *dst, const char *src)
 Compares two strings lexicographically.
 
char * ft_strdup (const char *src)
 Allocates and duplicates a null-terminated string.
 
void ft_striteri (char *s, void(*f)(unsigned int, char *))
 Applies a function to each character of a string, passing its index.
 
char * ft_strjoin (const char *s1, const char *s2)
 Concatenates two strings into a newly allocated string.
 
char * ft_strjoin_and_free (char *s1, char *s2, int free_s1, int free_s2)
 
size_t ft_strlcat (char *dest, const char *src, size_t size)
 Concatenates src to the end of dest while ensuring null-termination.
 
size_t ft_strlcpy (char *dest, const char *src, size_t size)
 Copies a string from src to dest, up to size - 1 characters.
 
size_t ft_strlen (const char *str)
 
char * ft_strmapi (char const *s, char(*f)(unsigned int, char))
 Applies a function to each character of a string to create a new string.
 
int ft_strncmp (const char *s1, const char *s2, size_t n)
 Compares two strings up to n characters.
 
char * ft_strndup (const char *src, size_t n)
 Creates a copy of a string, up to n characters.
 
char * ft_strnstr (const char *big, const char *little, size_t len)
 Searches for a substring in a string within a max length.
 
char * ft_strrchr (const char *str, int c)
 Returns a pointer to the last occurrence of a character in a string.
 
char * ft_strtrim (const char *s1, const char *set)
 Trims characters from both ends of a string.
 
char * ft_substr (const char *s, unsigned int start, size_t len)
 Extracts a substring from a string.
 
int ft_tolower (int c)
 Converts a character to lowercase.
 
int ft_toupper (int c)
 Converts a character to uppercase.
 
void skip_whitespace_index (const char *input, int *i)
 Skips leading whitespace by incrementing a pointer index.
 
char * skip_whitespace_ptr (const char *s)
 Returns a pointer to the first non-whitespace character.
 

Detailed Description

String manipulation utility functions.

Author
Toonsa
Date
2025/04/05

This header declares utility functions for handling and transforming C strings. It includes operations such as copying, trimming, joining, splitting, and case conversion.

These functions aim to replicate or extend the functionality of the C standard library with additional flexibility and safety.