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

Returns the number of characters in a string. More...

#include "libft.h"
+ Include dependency graph for ft_string.c:

Functions

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.
 
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_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.
 

Detailed Description

Returns the number of characters in a string.

Author
Toonsa
Date
2025/04/05

Iterates through the given null-terminated string to determine its length (not including the terminating \0).

Parameters
strThe string whose length is to be calculated.
Returns
The number of characters before the null terminator.