Skip to content

Instantly share code, notes, and snippets.

@mustafaturan
Created February 5, 2019 07:00
Show Gist options
  • Save mustafaturan/7a29e8251a7369645fb6c2965f8c2daf to your computer and use it in GitHub Desktop.
Save mustafaturan/7a29e8251a7369645fb6c2965f8c2daf to your computer and use it in GitHub Desktop.
Go / Chunk Slice
# https://play.golang.org/p/JxqibtHkuO-
func chunkBy(items []string, chunkSize int) (chunks [][]string) {
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize])
}
return append(chunks, items)
}
@SKTT1Ryze
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment