mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
Tweak string comparison to account for length (fixes #2831)
This commit is contained in:
parent
ea75f63dfb
commit
d5350fd719
@ -30,7 +30,9 @@ fun String.truncateCenter(count: Int, replacement: String = "..."): String {
|
||||
* Case-insensitive natural comparator for strings.
|
||||
*/
|
||||
fun String.compareToCaseInsensitiveNaturalOrder(other: String): Int {
|
||||
return String.CASE_INSENSITIVE_ORDER.then(naturalOrder()).compare(this, other)
|
||||
return compareBy<String> { it.length }
|
||||
.then(String.CASE_INSENSITIVE_ORDER)
|
||||
.then(naturalOrder()).compare(this, other)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user