1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2025-05-21 23:21:15 +02:00

feat: add string_pad_start

This commit is contained in:
2024-09-12 12:22:53 +02:00
parent 7683aa1db7
commit 35b868d0c1
4 changed files with 57 additions and 0 deletions

View File

@ -286,4 +286,16 @@ size_t string_position_of(const string_t string, const char character);
*/
size_t string_last_position_of(const string_t string, const char character);
/**
* @brief Pads a `string` with another `pad_string` (multiple times, if needed) until the resulting string reaches the `target_length`. The padding is applied from the start (left) of the string.
*
* @param string The string to pad.
* @param pad_string The string to pad the current string with, to the left.
* @param target_length
* @return string_t
* @example string_pad_start("hello", " ", 10) // " hello"
* @since vTODO
*/
string_t string_pad_start(const string_t string, const string_t pad_string, size_t target_length);
#endif