From e848bea0bfdfd564da831127430095384340190e Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Thu, 8 Jun 2023 14:09:09 -0600 Subject: [PATCH] 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. --- app/src/main/java/org/oxycblt/auxio/music/info/Name.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt b/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt index 838f8f5d5..4a8c0d3d9 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt @@ -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