package main
import (
"fmt"
"sort"
)
func main() {
str := "bfcawd"
s := []rune(str)
sort.Slice(s, func(i int, j int) bool { return s[i] < s[j] })
fmt.Println(string(s))
}
Output
abcdfw
package main
import (
"fmt"
"sort"
)
func main() {
str := "bfcawd"
s := []rune(str)
sort.Slice(s, func(i int, j int) bool { return s[i] < s[j] })
fmt.Println(string(s))
}
abcdfw