style(str): normed the header

This commit is contained in:
Raphael 2025-09-05 17:34:30 +02:00
parent e1625857f2
commit a3accb9d0a
No known key found for this signature in database

View file

@ -17,10 +17,10 @@
/** /**
* @brief Splits a string into an array of substrings based on a delimiter. * @brief Splits a string into an array of substrings based on a delimiter.
* *
* @param s The string to split. * @param s The string to split.
* @param c The delimiter character. * @param c The delimiter character.
* *
* @return A NULL-terminated array of substrings, * @return A NULL-terminated array of substrings,
* or NULL if memory allocation fails. * or NULL if memory allocation fails.
*/ */
@ -28,10 +28,10 @@ char **ft_split(char const *s, char c);
/** /**
* @brief Locates the first occurrence of a character in a string. * @brief Locates the first occurrence of a character in a string.
* *
* @param s The string to search. * @param s The string to search.
* @param c The character to locate. * @param c The character to locate.
* *
* @return A pointer to the matched character, * @return A pointer to the matched character,
* or NULL if it does not appear in `s`. * or NULL if it does not appear in `s`.
*/ */
@ -39,19 +39,19 @@ char *ft_strchr(const char *s, int c);
/** /**
* @brief Copies a string. * @brief Copies a string.
* *
* @param dst The destination buffer. * @param dst The destination buffer.
* @param src The source string. * @param src The source string.
* *
* @return A pointer to `dst`. * @return A pointer to `dst`.
*/ */
char *ft_strcpy(char *dst, const char *src); char *ft_strcpy(char *dst, const char *src);
/** /**
* @brief Duplicates a string. * @brief Duplicates a string.
* *
* @param s1 The string to duplicate. * @param s1 The string to duplicate.
* *
* @return A pointer to the duplicated string, * @return A pointer to the duplicated string,
* or NULL if memory allocation fails. * or NULL if memory allocation fails.
*/ */
@ -59,10 +59,10 @@ char *ft_strdup(const char *s);
/** /**
* @brief Joins two strings into a new string. * @brief Joins two strings into a new string.
* *
* @param s1 The first string. * @param s1 The first string.
* @param s2 The second string. * @param s2 The second string.
* *
* @return A pointer to the new concatenated string, * @return A pointer to the new concatenated string,
* or NULL if memory allocation fails. * or NULL if memory allocation fails.
*/ */
@ -70,10 +70,10 @@ char *ft_strjoin(char const *s1, char const *s2);
/** /**
* @brief Applies a function to each character of a string. * @brief Applies a function to each character of a string.
* *
* @param s The input string. * @param s The input string.
* @param f The function to apply to each character. * @param f The function to apply to each character.
* *
* @return A pointer to the newly created string, * @return A pointer to the newly created string,
* or NULL if memory allocation fails. * or NULL if memory allocation fails.
*/ */
@ -81,26 +81,26 @@ char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
/** /**
* @brief Copies a string. * @brief Copies a string.
* *
* @param dst The destination buffer. * @param dst The destination buffer.
* @param src The source string. * @param src The source string.
* @param size The size to copy * @param size The size to copy
* *
* @return A pointer to `dst`. * @return A pointer to `dst`.
*/ */
char *ft_strncpy(char *dst, const char *src, size_t size); char *ft_strncpy(char *dst, const char *src, size_t size);
/** /**
* @brief Locates a substring within a string, up to a specified length. * @brief Locates a substring within a string, up to a specified length.
* *
* The `ft_strnstr` function locates the first occurrence of the null-terminated * The `ft_strnstr` function locates the first occurrence of the null-terminated
* string `needle` within the string `haystack`, * string `needle` within the string `haystack`,
* searching only up to `len` characters. * searching only up to `len` characters.
* *
* @param big The string to search. * @param big The string to search.
* @param little The substring to locate. * @param little The substring to locate.
* @param len The maximum number of characters to search. * @param len The maximum number of characters to search.
* *
* @return A pointer to the beginning of the located substring, * @return A pointer to the beginning of the located substring,
* or NULL if `needle` is not found. * or NULL if `needle` is not found.
*/ */
@ -108,10 +108,10 @@ char *ft_strnstr(const char *big, const char *little, size_t len);
/** /**
* @brief Locates the last occurrence of a character in a string. * @brief Locates the last occurrence of a character in a string.
* *
* @param s The string to search. * @param s The string to search.
* @param c The character to locate. * @param c The character to locate.
* *
* @return A pointer to the matched character, * @return A pointer to the matched character,
* or NULL if it does not appear in `s`. * or NULL if it does not appear in `s`.
*/ */
@ -119,88 +119,88 @@ char *ft_strrchr(const char *s, int c);
/** /**
* @brief Trims specified characters from the start and end of a string. * @brief Trims specified characters from the start and end of a string.
* *
* @param s1 The string to trim. * @param s1 The string to trim.
* @param set The set of characters to remove. * @param set The set of characters to remove.
* *
* @return A pointer to the trimmed string, or NULL if memory allocation fails. * @return A pointer to the trimmed string, or NULL if memory allocation fails.
*/ */
char *ft_strtrim(char const *s1, char const *set); char *ft_strtrim(char const *s1, char const *set);
/** /**
* @brief Extracts a substring from a string. * @brief Extracts a substring from a string.
* *
* @param s The source string. * @param s The source string.
* @param start The starting index of the substring. * @param start The starting index of the substring.
* @param len The maximum length of the substring. * @param len The maximum length of the substring.
* *
* @return A pointer to the substring, or NULL if memory allocation fails. * @return A pointer to the substring, or NULL if memory allocation fails.
*/ */
char *ft_substr(char const *s, unsigned int start, size_t len); char *ft_substr(char const *s, unsigned int start, size_t len);
/** /**
* @brief Compares two strings lexicographically. * @brief Compares two strings lexicographically.
* *
* @param s1 The first string to compare. * @param s1 The first string to compare.
* @param s2 The second string to compare. * @param s2 The second string to compare.
* *
* @return An integer indicating the relationship between the two strings: * @return An integer indicating the relationship between the two strings:
* - `< 0` if `s1` is less than `s2`. * - `< 0` if `s1` is less than `s2`.
* - `0` if `s1` equals `s2`. * - `0` if `s1` equals `s2`.
* - `> 0` if `s1` is greater than `s2`. * - `> 0` if `s1` is greater than `s2`.
*/ */
int ft_strcmp(const char *s1, const char *s2); int ft_strcmp(const char *s1, const char *s2);
/** /**
* @brief Compares two strings up to a specified number of characters. * @brief Compares two strings up to a specified number of characters.
* *
* @param s1 The first string to compare. * @param s1 The first string to compare.
* @param s2 The second string to compare. * @param s2 The second string to compare.
* @param n The maximum number of characters to compare. * @param n The maximum number of characters to compare.
* *
* @return An integer indicating the relationship between the two strings. * @return An integer indicating the relationship between the two strings.
*/ */
int ft_strncmp(const char *s1, const char *s2, size_t n); int ft_strncmp(const char *s1, const char *s2, size_t n);
/** /**
* @brief Appends a string with size limit. * @brief Appends a string with size limit.
* *
* @param dst The destination buffer. * @param dst The destination buffer.
* @param src The source string. * @param src The source string.
* @param size The size of the destination buffer. * @param size The size of the destination buffer.
* *
* @return The total length of the string it tried to create. * @return The total length of the string it tried to create.
*/ */
size_t ft_strlcat(char *dst, const char *src, size_t size); size_t ft_strlcat(char *dst, const char *src, size_t size);
/** /**
* @brief Copies a string with size limit. * @brief Copies a string with size limit.
* *
* @param dst The destination buffer. * @param dst The destination buffer.
* @param src The source string. * @param src The source string.
* @param size The maximum number of characters to copy. * @param size The maximum number of characters to copy.
* *
* @return The total length of `src`. * @return The total length of `src`.
*/ */
size_t ft_strlcpy(char *dst, const char *src, size_t size); size_t ft_strlcpy(char *dst, const char *src, size_t size);
/** /**
* @brief Computes the length of a string. * @brief Computes the length of a string.
* *
* @param s The input string. * @param s The input string.
* *
* @return The number of characters in the string `s`. * @return The number of characters in the string `s`.
*/ */
size_t ft_strlen(const char *s); size_t ft_strlen(const char *s);
/** /**
* @brief Applies a function to each character of a string. * @brief Applies a function to each character of a string.
* *
* @param s The string to modify. * @param s The string to modify.
* @param f The function to apply to each character. * @param f The function to apply to each character.
* *
* @return void * @return void
*/ */
void ft_striteri(char *s, void (*f)(unsigned int, char*)); void ft_striteri(char *s, void (*f)(unsigned int, char *));
#endif #endif