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

feat: support giving a custom character for string_trim, string_trim_start, string_trim_end

BREAKING CHANGE: Functions signatures changed.
If you want to preserve the same behavior, you should pass explictly the space character to trim:
Example: `string_trim(" Hello ")` => `string_trim(" Hello ", ' ')`
This commit is contained in:
2023-08-05 14:19:44 +02:00
parent 316dfa10e7
commit 06b34b115b
3 changed files with 17 additions and 17 deletions

View File

@ -55,21 +55,21 @@ void string_replace_test() {
void string_trim_start_test() {
string_t string = " hello world ";
string = string_trim_start(string);
string = string_trim_start(string, ' ');
assert(assert_string_equal(string, "hello world "));
free(string);
}
void string_trim_end_test() {
string_t string = " hello world ";
string = string_trim_end(string);
string = string_trim_end(string, ' ');
assert(assert_string_equal(string, " hello world"));
free(string);
}
void string_trim_test() {
string_t string = " hello world ";
string = string_trim(string);
string = string_trim(string, ' ');
assert(assert_string_equal(string, "hello world"));
free(string);
}