Skip to content

Instantly share code, notes, and snippets.

@andreis
Created March 21, 2014 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreis/9692295 to your computer and use it in GitHub Desktop.
Save andreis/9692295 to your computer and use it in GitHub Desktop.
func Tokenize(s string) []string {
out := []string{}
for l, r := 0, 0; r < len(s); {
for l = r; isSep(s[l]); l++ {
}
for r = l; r < len(s) && !isSep(s[r]); r++ {
}
out = append(out, s[l:r])
}
return out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment