#How to assign filtered integers to an array or variable

12 messages · Page 1 of 1 (latest)

minor cosmos
#

re.FindAllString returns a []string

hardy lichen
minor cosmos
#

strconv is good for parsing to an int

hardy lichen
spare kiln
#

also, [0,1,2,3,4,5,6,7,8,9]+ is a weird regular expression

#

just use [0-9]+ or \d+

hardy lichen
chrome summitBOT
#
func Atoi(s string) (int, error)

Atoi is equivalent to ParseInt(s, 10, 0), converted to type int.

flat sail
#

iterate over resulting string slice, convert values and assign them to corresponding int slice index

hardy lichen
#

how should i type it tho?

flat sail
#

I suggest taking tour of go

fierce sparrowBOT