github.com/seeker-insurance/kit@v0.0.13/sortlib/strings.go (about)

     1  package sortlib
     2  
     3  import (
     4  	"sort"
     5  
     6  	"github.com/seeker-insurance/kit/sortlib/sortable"
     7  )
     8  
     9  //Bytes returns a sorted copy of the string, in ascending order (by bytes).
    10  func ByBytes(s string) string {
    11  	b := sortable.Bytes(s)
    12  	sort.Sort(b)
    13  	return string(b)
    14  }
    15  
    16  //Runes returns a sorted copy of the string, in ascending order (by runes).
    17  func ByRunes(s string) string {
    18  	r := sortable.Runes(s)
    19  	sort.Sort(r)
    20  	return string(r)
    21  }