comic-hasher/cmd/hash/natsort/main.go
Timmy Welch c61ade9961 stuff
2024-07-31 11:35:17 -07:00

35 lines
597 B
Go

package main
import (
"fmt"
"strings"
"golang.org/x/text/collate"
"golang.org/x/text/language"
)
func main() {
c := collate.New(language.English, collate.Loose, collate.Numeric, collate.Force)
list := []string{
"11.jpg",
"12.jpg",
"2.jpg",
"99999999999999999.jpg",
"02.jpg",
"00.jpg",
"0.jpg",
"00.jpg",
"1.jpg",
"01.jpg",
"Page3.gif",
"page0.jpg",
"Page1.jpeg",
"Page2.png",
"!cover.jpg", // Depending on locale punctuation or numbers might come first (Linux)
"page4.webp",
"page10.jpg",
}
c.SortStrings(list)
fmt.Println(strings.Join(list, "\n"))
}