mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Tweak string comparison to account for length (fixes #2831)
This commit is contained in:
parent
ea75f63dfb
commit
d5350fd719
1 changed files with 3 additions and 1 deletions
|
@ -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 a new issue