From 9686b8b8463b10c58fb999d22837d4617988ad7d Mon Sep 17 00:00:00 2001 From: Peter Kleiweg Date: Wed, 25 Mar 2026 17:46:31 +0100 Subject: [PATCH] cmd/score/score.go: case-insensitive sort --- cmd/score/score.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/score/score.go b/cmd/score/score.go index 52b8c59..e1ccf09 100644 --- a/cmd/score/score.go +++ b/cmd/score/score.go @@ -13,9 +13,10 @@ import ( ) type Item struct { - text string - score int - isnew bool + text string + lctext string + score int + isnew bool } var ( @@ -50,9 +51,10 @@ func main() { x(err) n1, ok := count[aa[1]] items = append(items, Item{ - text: aa[1], - score: n - n1, - isnew: !ok, + text: aa[1], + lctext: strings.ToLower(aa[1]), + score: n - n1, + isnew: !ok, }) } x(scanner.Err()) @@ -70,7 +72,7 @@ func main() { if items[i].score != items[j].score { return items[i].score > items[j].score } - return items[i].text < items[j].text + return items[i].lctext < items[j].lctext }) for _, item := range items {