Skip to content

Instantly share code, notes, and snippets.

@oscarzhou
Last active December 16, 2019 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarzhou/5144a2b869e1dd64dd2e75bec122eb2e to your computer and use it in GitHub Desktop.
Save oscarzhou/5144a2b869e1dd64dd2e75bec122eb2e to your computer and use it in GitHub Desktop.
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