Skip to content

Instantly share code, notes, and snippets.

@OrKoN
Last active April 7, 2019 09:23
Show Gist options
  • Save OrKoN/cbbf0d4032b4bf3ffc0125eeff845f8b to your computer and use it in GitHub Desktop.
Save OrKoN/cbbf0d4032b4bf3ffc0125eeff845f8b to your computer and use it in GitHub Desktop.
String index of a substring with start index
import "strings"
func indexAt(str, substr string, start int) int {
idx := strings.Index(str[start:], substr)
if idx == -1 {
return idx
}
return idx + start
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment