Browse Source

Merge pull request #654 from 01-edu/range-fix

adding spaces in the output
content-update
MSilva95 4 years ago committed by GitHub
parent
commit
80f5d5b7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      go/tests/prog/grouping_prog/main.go
  2. 12
      go/tests/prog/range_prog/main.go

8
go/tests/prog/grouping_prog/main.go

@ -45,17 +45,13 @@ func brackets(regexp, text string) {
runes = runes[1 : len(runes)-1]
result := simpleSearch(runes, text)
for i, s := range result {
if !unicode.Is(unicode.Hex_Digit, rune(s[len(s)-1])) {
s = s[:len(s)-1]
}
if !unicode.Is(unicode.Hex_Digit, rune(s[0])) {
s = s[1:]
if !unicode.Is(unicode.Hex_Digit, rune(s[len(s)-1])) && !unicode.IsLetter(rune(s[len(s)-1])) {
s = s[0 : len(s)-1]
}
fmt.Printf("%d: %s\n", i+1, s)
}
}
}
func main() {
// brackets("al|b", "ale atg bar sim nao pro par impar") In JS it's used without brackets
if len(os.Args) == 3 {

12
go/tests/prog/range_prog/main.go

@ -4,8 +4,6 @@ import (
"fmt"
"os"
"strconv"
"lib"
)
func main() {
@ -22,8 +20,14 @@ func main() {
fmt.Println(err)
return
}
for _, i := range lib.IntRange(a, b) {
fmt.Print(i)
fmt.Print(a)
for b != a {
if a < b {
a++
} else {
a--
}
fmt.Print(" ", a)
}
fmt.Println()
}

Loading…
Cancel
Save