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:
Alexander Capehart
2023-06-08 14:09:09 -06:00
parent 93d3e82140
commit e848bea0bf
@@ -203,8 +203,7 @@ private data class IntelligentKnownName(override val raw: String, override val s
// Separate each token into their numeric and lexicographic counterparts.
if (token.first().isDigit()) {
// The digit string comparison breaks with preceding zero digits, remove those
// TODO: Handle zero digits in other languages
val digits = token.trimStart('0').ifEmpty { token }
val digits = token.trimStart { Character.getNumericValue(it) == 0 }.ifEmpty { token }
// Other languages have other types of digit strings, still use collation keys
collationKey = COLLATOR.getCollationKey(digits)
type = SortToken.Type.NUMERIC