2021-10-19 09:37:49 +02:00
|
|
|
#ifndef __STRING__
|
|
|
|
#define __STRING__
|
2021-09-29 22:20:41 +02:00
|
|
|
|
2023-08-10 11:13:06 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "character.h"
|
|
|
|
|
2021-09-29 22:20:41 +02:00
|
|
|
/**
|
2023-08-10 11:13:06 +02:00
|
|
|
* @brief Return the length of a string (excluding '\0').
|
2021-09-29 22:20:41 +02:00
|
|
|
*
|
|
|
|
* @param string
|
2023-08-10 11:13:06 +02:00
|
|
|
* @return size_t
|
2021-09-29 22:20:41 +02:00
|
|
|
*/
|
2023-08-10 11:13:06 +02:00
|
|
|
size_t string_get_length(const char* string);
|
2021-09-29 22:20:41 +02:00
|
|
|
|
|
|
|
/**
|
2023-08-10 11:13:06 +02:00
|
|
|
* @brief Removes all `character` from the start of a string.
|
|
|
|
*
|
|
|
|
* NOTE: Mutates the string.
|
2021-09-29 22:20:41 +02:00
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
*/
|
2023-08-10 11:13:06 +02:00
|
|
|
void string_trim_start(char* string, char character);
|
2021-09-29 22:20:41 +02:00
|
|
|
|
|
|
|
/**
|
2023-08-10 11:13:06 +02:00
|
|
|
* @brief Removes all `character` from the end of a string.
|
|
|
|
*
|
|
|
|
* NOTE: Mutates the string.
|
2021-09-29 22:20:41 +02:00
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
*/
|
2023-08-10 11:13:06 +02:00
|
|
|
void string_trim_end(char* string, char character);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes all `character` from the start and end of a string.
|
|
|
|
*
|
|
|
|
* NOTE: Mutates the string.
|
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
*/
|
|
|
|
void string_trim(char* string, char character);
|
2021-09-29 22:20:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Converts a string to camel case.
|
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
* @return char*
|
|
|
|
*/
|
|
|
|
char* string_camelCase(char* string);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Capitalizes the string.
|
|
|
|
*
|
2023-08-10 11:13:06 +02:00
|
|
|
* NOTE: Mutates the string.
|
|
|
|
*
|
2021-09-29 22:20:41 +02:00
|
|
|
* @param string
|
|
|
|
*/
|
2023-08-10 11:13:06 +02:00
|
|
|
void string_capitalize(char* string);
|
2021-09-29 22:20:41 +02:00
|
|
|
|
|
|
|
#endif
|