Both Finder and Files sort by name using localizedStandardCompare. By using localizedCaseInsensitiveCompare, we introduce potentially counterintuitive behavior. For example, a user may import multiple files which appear to be sorted correctly in Finder/Files and then discover that we play them in a different order.
Like localizedCaseInsensitiveCompare, localizedStandardCompare is also case insensitive, but also accounts for numeric non-lexicographic sorting. For example (1...25).map { String($0) } will not change order when sorted with localizedStandardCompare, but with localizedCaseInsensitiveCompare the order will change to ["1", "10", "11", "12", ...].
Both Finder and Files sort by name using
localizedStandardCompare
. By usinglocalizedCaseInsensitiveCompare
, we introduce potentially counterintuitive behavior. For example, a user may import multiple files which appear to be sorted correctly in Finder/Files and then discover that we play them in a different order.Like
localizedCaseInsensitiveCompare
,localizedStandardCompare
is also case insensitive, but also accounts for numeric non-lexicographic sorting. For example(1...25).map { String($0) }
will not change order when sorted withlocalizedStandardCompare
, but withlocalizedCaseInsensitiveCompare
the order will change to["1", "10", "11", "12", ...]
.I also noticed
localizedCaseInsensitiveContains
being used. Based on my reading of the code, I think normalcontains
may be appropriate, but, if not, perhapslocalizedStandardContains
should be used instead. https://github.com/readium/swift-toolkit/blob/8fad4d5acd4603270c9d333545b58a6fb649d98d/Sources/Navigator/EPUB/CSS/ReadiumCSS.swift#L140-L144