Skip to content

Instantly share code, notes, and snippets.

@oscarzhou
Last active Dec 16, 2019
Embed
What would you like to do?
package main
import (
"fmt"
"sort"
)
func main() {
s := []rune("helloworld")
s1 := []rune(s[0:5])
fmt.Println("before: ",string(s1))
sort.Slice(s1, func (i,j int) bool{
return s1[i]<s1[j]
})
fmt.Println("after: ", string(s1))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment