Skip to content

Instantly share code, notes, and snippets.

@P-A-R-U-S
Last active October 20, 2019 07:02
Show Gist options
  • Save P-A-R-U-S/1f175415c41d09f0d2fe8830964b7b22 to your computer and use it in GitHub Desktop.
Save P-A-R-U-S/1f175415c41d09f0d2fe8830964b7b22 to your computer and use it in GitHub Desktop.
Sort Byte ([]byte) array in Go/Golang
b := []byte("9856743210")
fmt.Println("Before:", string(b))
sort.Slice(b, func(i, j int) bool {
return b[i] < b[j]
})
fmt.Println("After:", string(b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment