Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "sort"
- // ByteSlice attaches the methods of sort.Interface to []byte, sorting in
- // increasing order.
- type ByteSlice []byte
- func (s ByteSlice) Len() int { return len(s) }
- func (s ByteSlice) Less(i, j int) bool { return s[i] < s[j] }
- func (s ByteSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
- // Sort is a convenience method.
- func (s ByteSlice) Sort() {
- sort.Sort(s)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement