LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s.
package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.Index("go gopher", "go")) fmt.Println(strings.LastIndex("go gopher", "go")) fmt.Println(strings.LastIndex("go gopher", "rodent")) }