pull/783/head
gedoor 4 years ago
parent ad3eca3a55
commit 28623487e5
  1. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  2. 5
      app/src/main/java/io/legado/app/utils/StringUtils.kt

@ -231,7 +231,9 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions {
if (result == null) result = "" if (result == null) result = ""
val str = kotlin.runCatching { val str = kotlin.runCatching {
Entities.unescape(result.toString()) Entities.unescape(result.toString())
}.getOrDefault(result.toString()) }.getOrElse {
result.toString()
}
if (isUrl) { if (isUrl) {
return if (str.isBlank()) { return if (str.isBlank()) {
baseUrl ?: "" baseUrl ?: ""

@ -214,12 +214,11 @@ object StringUtils {
fun stringToInt(str: String?): Int { fun stringToInt(str: String?): Int {
if (str != null) { if (str != null) {
val num = fullToHalf(str).replace("\\s+".toRegex(), "") val num = fullToHalf(str).replace("\\s+".toRegex(), "")
return try { return kotlin.runCatching {
Integer.parseInt(num) Integer.parseInt(num)
} catch (e: Exception) { }.getOrElse {
chineseNumToInt(num) chineseNumToInt(num)
} }
} }
return -1 return -1
} }

Loading…
Cancel
Save