mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
style: fix editorconfig lint
This commit is contained in:
parent
a6bd36b754
commit
08fd145584
@ -31,14 +31,13 @@ bool string_is_palindrome(const char* string) {
|
||||
return is_palindrome;
|
||||
}
|
||||
|
||||
char* string_replace(const char* string, char search_value,
|
||||
char replace_value) {
|
||||
char* string_replace(const char* string, char search, char replace) {
|
||||
size_t string_length = strlen(string);
|
||||
char* result = malloc(sizeof(char) * (string_length + 1));
|
||||
for (size_t index = 0; index < string_length; index++) {
|
||||
bool is_search_value = search_value == string[index];
|
||||
bool is_search_value = search == string[index];
|
||||
if (is_search_value) {
|
||||
character_append(result, replace_value);
|
||||
character_append(result, replace);
|
||||
} else {
|
||||
character_append(result, string[index]);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ char* string_reverse(const char* string);
|
||||
bool string_is_palindrome(const char* string);
|
||||
|
||||
/**
|
||||
* @brief Replace all the occurrences of search_value into replace_value in
|
||||
* @brief Replace all the occurrences of search value into replace value in
|
||||
* the string.
|
||||
*
|
||||
* @param string
|
||||
@ -38,6 +38,6 @@ bool string_is_palindrome(const char* string);
|
||||
* @param replace_value A character containing the text to replace for match.
|
||||
* @return char*
|
||||
*/
|
||||
char* string_replace(const char* string, char search_value, char replace_value);
|
||||
char* string_replace(const char* string, char search, char replace);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user