aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt')
-rw-r--r--ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt b/ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt
index 96e69c58..9fb96cab 100644
--- a/ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt
+++ b/ui/src/main/java/com/wireguard/android/model/TunnelComparator.kt
@@ -25,7 +25,9 @@ object TunnelComparator : Comparator<String> {
return 0
}
}
+
val tokens: MutableList<NaturalSortToken> = ArrayList()
+
init {
for (s in NATURAL_SORT_DIGIT_FINDER.findAll(originalString.split(WHITESPACE_FINDER).joinToString(" ").toLowerCase(Locale.ENGLISH))) {
try {
@@ -36,6 +38,7 @@ object TunnelComparator : Comparator<String> {
}
}
}
+
private companion object {
private val NATURAL_SORT_DIGIT_FINDER = Regex("""\d+|\D+""")
private val WHITESPACE_FINDER = Regex("""\s""")