music: remove zero digit-likes from names
Remove all characters with a semantic meaning of "zero" from the start of music names, at least when intelligent sorting is enabled.
This commit is contained in:
parent
93d3e82140
commit
e848bea0bf
1 changed files with 1 additions and 2 deletions
|
@ -203,8 +203,7 @@ private data class IntelligentKnownName(override val raw: String, override val s
|
||||||
// Separate each token into their numeric and lexicographic counterparts.
|
// Separate each token into their numeric and lexicographic counterparts.
|
||||||
if (token.first().isDigit()) {
|
if (token.first().isDigit()) {
|
||||||
// The digit string comparison breaks with preceding zero digits, remove those
|
// The digit string comparison breaks with preceding zero digits, remove those
|
||||||
// TODO: Handle zero digits in other languages
|
val digits = token.trimStart { Character.getNumericValue(it) == 0 }.ifEmpty { token }
|
||||||
val digits = token.trimStart('0').ifEmpty { token }
|
|
||||||
// Other languages have other types of digit strings, still use collation keys
|
// Other languages have other types of digit strings, still use collation keys
|
||||||
collationKey = COLLATOR.getCollationKey(digits)
|
collationKey = COLLATOR.getCollationKey(digits)
|
||||||
type = SortToken.Type.NUMERIC
|
type = SortToken.Type.NUMERIC
|
||||||
|
|
Loading…
Reference in a new issue