mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
716 B
22 lines
716 B
5 years ago
|
## searchreplace
|
||
5 years ago
|
|
||
5 years ago
|
### Instructions
|
||
5 years ago
|
|
||
5 years ago
|
Write a program that takes 3 arguments, the first argument is a `string` in which to replace a letter (the 2nd argument) by another one (the 3rd argument).
|
||
5 years ago
|
|
||
![]()
4 years ago
|
- If the number of arguments is different from 3, the program displays nothing.
|
||
5 years ago
|
|
||
5 years ago
|
- If the second argument is not contained in the first one (the string) then the program rewrites the `string` followed by a newline (`'\n'`).
|
||
5 years ago
|
|
||
5 years ago
|
### Usage
|
||
5 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test "hella there" "a" "o"
|
||
5 years ago
|
hello there
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test "abcd" "z" "l"
|
||
5 years ago
|
abcd
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test "something" "a" "o" "b" "c"
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
5 years ago
|
```
|