nightingale/vendor/github.com/toolkits/pkg/str/map.go

16 lines
209 B
Go

package str
import "sort"
func KeysOfMap(m map[string]string) []string {
keys := make(sort.StringSlice, len(m))
i := 0
for key := range m {
keys[i] = key
i++
}
keys.Sort()
return []string(keys)
}