Alexander Avery
1 year ago
1 changed files with 24 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"bufio" |
|||
"strconv" |
|||
"strings" |
|||
) |
|||
|
|||
var spaceReplacer = strings.NewReplacer("\t", "", " ", "") |
|||
|
|||
func scanints(str string) []int { |
|||
ints := make([]int, 0) |
|||
scanner := bufio.NewScanner(strings.NewReader(str)) |
|||
scanner.Split(bufio.ScanWords) |
|||
|
|||
for scanner.Scan() { |
|||
val, err := strconv.Atoi(scanner.Text()) |
|||
if err != nil { |
|||
panic(err) |
|||
} |
|||
ints = append(ints, val) |
|||
} |
|||
return ints |
|||
} |
Loading…
Reference in new issue