sort.go 214 B

123456789101112131415
  1. package utils
  2. type StrArr []string
  3. func (a StrArr) Len() int {
  4. return len(a)
  5. }
  6. func (a StrArr) Less(i, j int) bool {
  7. return a[i] > a[j] // 降序
  8. }
  9. func (a StrArr) Swap(i, j int) {
  10. a[i], a[j] = a[j], a[i]
  11. }