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;
|
return is_palindrome;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* string_replace(const char* string, char search_value,
|
char* string_replace(const char* string, char search, char replace) {
|
||||||
char replace_value) {
|
|
||||||
size_t string_length = strlen(string);
|
size_t string_length = strlen(string);
|
||||||
char* result = malloc(sizeof(char) * (string_length + 1));
|
char* result = malloc(sizeof(char) * (string_length + 1));
|
||||||
for (size_t index = 0; index < string_length; index++) {
|
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) {
|
if (is_search_value) {
|
||||||
character_append(result, replace_value);
|
character_append(result, replace);
|
||||||
} else {
|
} else {
|
||||||
character_append(result, string[index]);
|
character_append(result, string[index]);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ char* string_reverse(const char* string);
|
|||||||
bool string_is_palindrome(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.
|
* the string.
|
||||||
*
|
*
|
||||||
* @param 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.
|
* @param replace_value A character containing the text to replace for match.
|
||||||
* @return char*
|
* @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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user