Last active
October 20, 2019 07:02
-
-
Save P-A-R-U-S/1f175415c41d09f0d2fe8830964b7b22 to your computer and use it in GitHub Desktop.
Sort Byte ([]byte) array in Go/Golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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