diff --git a/go/tests/prog/grouping_prog/main.go b/go/tests/prog/grouping_prog/main.go index b953ef0d..718710b5 100644 --- a/go/tests/prog/grouping_prog/main.go +++ b/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 { diff --git a/go/tests/prog/range_prog/main.go b/go/tests/prog/range_prog/main.go index a65297e6..50065842 100644 --- a/go/tests/prog/range_prog/main.go +++ b/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() }