1
1
package surge
2
2
3
+ import "strings"
4
+
3
5
/*type Interface interface {
4
6
// Len is the number of elements in the collection.
5
7
Len() int
@@ -24,15 +26,19 @@ func (a sortBySeederCountDesc) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
24
26
25
27
type sortByFileNameAsc []FileListing
26
28
27
- func (a sortByFileNameAsc ) Len () int { return len (a ) }
28
- func (a sortByFileNameAsc ) Less (i , j int ) bool { return a [i ].FileName < a [j ].FileName }
29
- func (a sortByFileNameAsc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
29
+ func (a sortByFileNameAsc ) Len () int { return len (a ) }
30
+ func (a sortByFileNameAsc ) Less (i , j int ) bool {
31
+ return strings .ToLower (a [i ].FileName ) < strings .ToLower (a [j ].FileName )
32
+ }
33
+ func (a sortByFileNameAsc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
30
34
31
35
type sortByFileNameDesc []FileListing
32
36
33
- func (a sortByFileNameDesc ) Len () int { return len (a ) }
34
- func (a sortByFileNameDesc ) Less (i , j int ) bool { return a [i ].FileName > a [j ].FileName }
35
- func (a sortByFileNameDesc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
37
+ func (a sortByFileNameDesc ) Len () int { return len (a ) }
38
+ func (a sortByFileNameDesc ) Less (i , j int ) bool {
39
+ return strings .ToLower (a [i ].FileName ) > strings .ToLower (a [j ].FileName )
40
+ }
41
+ func (a sortByFileNameDesc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
36
42
37
43
type sortByFileSizeAsc []FileListing
38
44
@@ -48,12 +54,16 @@ func (a sortByFileSizeDesc) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
48
54
49
55
type sortLocalByFileNameAsc []File
50
56
51
- func (a sortLocalByFileNameAsc ) Len () int { return len (a ) }
52
- func (a sortLocalByFileNameAsc ) Less (i , j int ) bool { return a [i ].FileName < a [j ].FileName }
53
- func (a sortLocalByFileNameAsc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
57
+ func (a sortLocalByFileNameAsc ) Len () int { return len (a ) }
58
+ func (a sortLocalByFileNameAsc ) Less (i , j int ) bool {
59
+ return strings .ToLower (a [i ].FileName ) < strings .ToLower (a [j ].FileName )
60
+ }
61
+ func (a sortLocalByFileNameAsc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
54
62
55
63
type sortLocalByFileNameDesc []File
56
64
57
- func (a sortLocalByFileNameDesc ) Len () int { return len (a ) }
58
- func (a sortLocalByFileNameDesc ) Less (i , j int ) bool { return a [i ].FileName > a [j ].FileName }
59
- func (a sortLocalByFileNameDesc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
65
+ func (a sortLocalByFileNameDesc ) Len () int { return len (a ) }
66
+ func (a sortLocalByFileNameDesc ) Less (i , j int ) bool {
67
+ return strings .ToLower (a [i ].FileName ) > strings .ToLower (a [j ].FileName )
68
+ }
69
+ func (a sortLocalByFileNameDesc ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
0 commit comments