Browse Source

style(pisicine-go): fix white-space and formatting

fixDevirged
Tiago Collot 2 years ago
parent
commit
0797dd68db
  1. 16
      subjects/loafofbread/README.md

16
subjects/loafofbread/README.md

@ -4,9 +4,9 @@
Write a function `LoafOfBread()` that takes a string and returns another one with words of 5 characters and skips the next character followed by newline `\n`. Write a function `LoafOfBread()` that takes a string and returns another one with words of 5 characters and skips the next character followed by newline `\n`.
- If there is a space in the middle of a word it should ignore it and get the first character until getting to a length of 5. - If there is a space in the middle of a word it should ignore it and get the next character until getting to a length of 5.
- If the string less than 5 characters returns "Invalid Output\n" - If the string is less than 5 characters return "Invalid Output\n".
-
### Expected function ### Expected function
```go ```go
@ -16,7 +16,7 @@ func LoafOfBread(str string) string {
### Usage ### Usage
Here is a possible program to test your function : Here is a possible program to test your function:
```go ```go
package main package main
@ -24,21 +24,17 @@ package main
import "fmt" import "fmt"
func main() { func main() {
LoafOfBread("deliciousbread")
LoafOfBread("This is a loaf of bread")
LoafOfBread("Bread crumbles")
fmt.Print(LoafOfBread("deliciousbread")) fmt.Print(LoafOfBread("deliciousbread"))
fmt.Print(LoafOfBread("This is a loaf of bread")) fmt.Print(LoafOfBread("This is a loaf of bread"))
fmt.Print(LoafOfBread("loaf")) fmt.Print(LoafOfBread("loaf"))
} }
``` ```
And its output : And its output:
```go ```go
$ go run . | cat -e $ go run . | cat -e
delic ousbr ad$ delic ousbr ad$
Thisi ashor sente ce$ Thisi aloaf fbrea$
This s a l af of bread$
Invalid Output$ Invalid Output$
``` ```

Loading…
Cancel
Save