2019-04-23 11:06:01 +00:00
## searchreplace
2019-04-18 12:50:04 +00:00
2019-04-23 11:06:01 +00:00
### Instructions
2019-04-18 12:50:04 +00:00
2021-06-14 13:35:42 +00:00
Write a program that takes 3 arguments, the first argument is a `string` in which a letter (the 2nd argument) will be replaced by another one (the 3rd argument).
2019-04-18 12:50:04 +00:00
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
2020-04-26 10:29:55 +00:00
- If the number of arguments is different from 3, the program displays nothing.
2019-04-18 12:50:04 +00:00
2020-02-25 12:02:16 +00:00
- If the second argument is not contained in the first one (the string) then the program rewrites the `string` followed by a newline (`'\n'`).
2019-04-18 12:50:04 +00:00
2019-06-15 07:44:37 +00:00
### Usage
2019-04-18 12:50:04 +00:00
```console
2021-04-28 09:47:34 +00:00
$ go run . "hella there" "a" "o"
2019-04-18 12:50:04 +00:00
hello there
2021-06-14 13:35:42 +00:00
$ go run . "hallo thara" "a" "e"
hello there
2021-04-28 09:47:34 +00:00
$ go run . "abcd" "z" "l"
2019-04-18 12:50:04 +00:00
abcd
2021-04-28 09:47:34 +00:00
$ go run . "something" "a" "o" "b" "c"
$
2019-04-24 11:15:11 +00:00
```