pull/32/head
Administrator 5 years ago
parent 5854a2182c
commit 3d4693ea9a
  1. 3
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  2. 4
      app/src/main/java/io/legado/app/utils/StringExtensions.kt

@ -462,8 +462,7 @@ class AnalyzeRule(private var book: BaseBook? = null) {
}
//分离正则表达式
val ruleStrS =
rule.trim { it <= ' ' }.split("##".toRegex()).dropLastWhile { it.isEmpty() }
.toTypedArray()
rule.trim { it <= ' ' }.splitNotBlank("##")
rule = ruleStrS[0]
if (ruleStrS.size > 1) {
replaceRegex = ruleStrS[1]

@ -27,8 +27,8 @@ fun String.splitNotBlank(delimiter: String): Array<String> = run {
this.split(delimiter).map { it.trim() }.filterNot { it.isBlank() }.toTypedArray()
}
fun String.splitNotBlank(regex: Regex): Array<String> = run {
this.split(regex).map { it.trim() }.filterNot { it.isBlank() }.toTypedArray()
fun String.splitNotBlank(regex: Regex, limit: Int = 0): Array<String> = run {
this.split(regex, limit).map { it.trim() }.filterNot { it.isBlank() }.toTypedArray()
}
fun String.startWithIgnoreCase(start: String): Boolean {

Loading…
Cancel
Save