Advertisement
Guest User

Untitled

a guest
May 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. // Split slices s into all substrings separated by sep and
  2. // returns a slice of the substrings between those separators.
  3. func Split(s, sep string) []string {
  4. var result []string
  5. i := strings.Index(s, sep)
  6. for i > -1 {
  7. result = append(result, s[:i])
  8. s = s[i+len(sep):]
  9. i = strings.Index(s, sep)
  10. }
  11. return append(result, s)
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement