String functions. More...
Functions | |
size_t | ft_strlen (const char *the_string) |
Len of string without '\0'. | |
size_t | ft_strlen_char (const char *the_string, int character) |
Number of occurrence of character in the string. | |
size_t | ft_strlcpy (char *dst, const char *src, size_t size) |
size_t | ft_strlcat (char *dst, const char *src, size_t size) |
Concatenate src into dst, up to size bytes. | |
char * | ft_strchr (const char *string, int searched_char) |
Find first occurrence of searched_char. | |
char * | ft_strrchr (const char *string, int searched_char) |
Find last occurrence of searched_char. | |
int | ft_strncmp (const char *first, const char *second, size_t length) |
Find differences between first and second. | |
const char * | ft_strnstr (const char *big, const char *little, size_t len) |
Search a substring in a bigger string, up to len position in string. | |
char * | ft_strdup (const char *source) |
Create a copy of source into a new pointer NEEDS to be freed. | |
char * | ft_strndup (const char *source, size_t len) |
Create a copy of source into a new pointer of size len NEEDS to be freed. | |
char * | ft_substr (char const *src, unsigned int start, size_t len) |
Create a copy of source into a new pointer, at start, of size len NEEDS to be freed. | |
char * | ft_strjoin (char const *s1, char const *s2) |
Allocates a new string, and returns the result of a concatenation of s1 and s2. | |
char * | ft_strjoins (char **str) |
Allocates a new string, and returns the result of a concatenation of all the strings from the array last argument needs to be NULL. | |
char * | ft_strtrim (char const *s, char const *set) |
Deletes all characters that exist in s and set, if they are at the beginning of the string or at the end. | |
char ** | ft_split (char const *s, char c) |
Allocates with a malloc and returns an array of strings obtained by separating ’s’ using the character ’c’, used as a delimiter. The array must be terminated by NULL. | |
char * | ft_strmapi (char const *s, char(*f)(unsigned int, char)) |
Apply the function ’f’ to each character of the string ’s’, passing its index as first argument and the character itself as second argument. | |
void | ft_striteri (char *s, void(*f)(unsigned int, char *)) |
Iterate the function f on string s. | |
String functions.
char ** ft_split | ( | char const * | s, |
char | c ) |
Allocates with a malloc and returns an array of strings obtained by separating ’s’ using the character ’c’, used as a delimiter. The array must be terminated by NULL.
s | string to print |
c | char used as a delimiter |
char * ft_strchr | ( | const char * | string, |
int | searched_char ) |
Find first occurrence of searched_char.
string | string to search in |
searched_char | char to search |
char * ft_strdup | ( | const char * | source | ) |
Create a copy of source into a new pointer NEEDS to be freed.
source | string to copy |
void ft_striteri | ( | char * | s, |
void(* | f )(unsigned int, char *) ) |
Iterate the function f on string s.
s | string to iterate |
f | function to apply |
char * ft_strjoin | ( | char const * | s1, |
char const * | s2 ) |
Allocates a new string, and returns the result of a concatenation of s1 and s2.
s1 | string 1 |
s2 | string 2 |
char * ft_strjoins | ( | char ** | array | ) |
Allocates a new string, and returns the result of a concatenation of all the strings from the array last argument needs to be NULL.
array | Array of strings |
size_t ft_strlcat | ( | char * | dst, |
const char * | src, | ||
size_t | size ) |
Concatenate src into dst, up to size bytes.
dst | destination string |
src | source string |
size | size of the destination string |
size_t ft_strlcpy | ( | char * | dst, |
const char * | src, | ||
size_t | size ) |
size_t ft_strlen | ( | const char * | the_string | ) |
Len of string without '\0'.
the_string | string to check |
size_t ft_strlen_char | ( | const char * | the_string, |
int | character ) |
Number of occurrence of character in the string.
the_string | string to check |
character | character to count |
char * ft_strmapi | ( | char const * | s, |
char(* | f )(unsigned int, char) ) |
Apply the function ’f’ to each character of the string ’s’, passing its index as first argument and the character itself as second argument.
s | string to iterate |
f | function to apply |
int ft_strncmp | ( | const char * | first, |
const char * | second, | ||
size_t | length ) |
Find differences between first and second.
first | first string to compare |
second | second string to compare |
length | number of characters to compare |
char * ft_strndup | ( | const char * | source, |
size_t | len ) |
Create a copy of source into a new pointer of size len NEEDS to be freed.
source | string to copy |
len | size of the new string |
const char * ft_strnstr | ( | const char * | big, |
const char * | little, | ||
size_t | len ) |
Search a substring in a bigger string, up to len position in string.
big | string to search in |
little | string to search |
len | max size of big |
char * ft_strrchr | ( | const char * | string, |
int | searched_char ) |
Find last occurrence of searched_char.
string | string to search in |
searched_char | character to search |
char * ft_strtrim | ( | char const * | s, |
char const * | set ) |
Deletes all characters that exist in s and set, if they are at the beginning of the string or at the end.
s | string to trim |
set | string of characters to trim |
char * ft_substr | ( | char const * | src, |
unsigned int | start, | ||
size_t | len ) |
Create a copy of source into a new pointer, at start, of size len NEEDS to be freed.
src | string to copy |
start | start of the copy |
len | size of the copy |