Tell me: how to get the numbers out of the line?

    1 answer 1

    You can make a regular expression:

    package main import "fmt" import "regexp" func main() { str := "Hello, today is January 11. I am 28 now. Date of birth 11.01.1990." fmt.Println("Test string", str) re := regexp.MustCompile("[0-9]+") fmt.Println(re.FindAllString(str, -1)) } 

    You can run the code here: https://play.golang.org/p/4FayPuOwBSx