public/subjects/searchreplace/README.md

23 lines
612 B
Markdown
Raw Permalink Normal View History

## searchreplace
2019-04-18 12:50:04 +00:00
### Instructions
2019-04-18 12:50:04 +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
- 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
$ go run . "hella there" "a" "o"
2019-04-18 12:50:04 +00:00
hello there
$ go run . "hallo thara" "a" "e"
hello there
$ go run . "abcd" "z" "l"
2019-04-18 12:50:04 +00:00
abcd
$ go run . "something" "a" "o" "b" "c"
$
```