Skip to content

Instantly share code, notes, and snippets.

@roylee0704
Created May 12, 2016 11:24
Show Gist options
  • Save roylee0704/0c18d1a95c1e96207283bcb729955424 to your computer and use it in GitHub Desktop.
Save roylee0704/0c18d1a95c1e96207283bcb729955424 to your computer and use it in GitHub Desktop.
substring implemented naively.
func naive_substr(s, t string) bool {
if len(s) > len(t) {
return false
}
for i := 0; i < len(t)-len(s); i++ {
if !compare(s, t[i:len(s)+i]) {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment