From 32242537f85ebbda33db4e0fbac67fa970ae2586 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Sun, 4 Jul 2021 23:36:41 +0800 Subject: [PATCH] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正刚才的更新中,找到筛选器起始字符时,未重置位置导致分隔字串被划分到下一段规则的问题。 --- .../java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index dfc5cae23..6f736259d 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -130,9 +130,9 @@ class RuleAnalyzer(data: String) { */ private fun findToAny(vararg seq:Char): Int { - val start = pos //声明新变量记录临时起始位置,不更改类本身的起始位置 + var pos = pos //声明新变量记录匹配位置,不更改类本身的位置 - while (!isEmpty) { + while (pos != queue.length) { for (s in seq) if(queue[pos] == s) return pos //匹配则返回位置 @@ -140,8 +140,6 @@ class RuleAnalyzer(data: String) { } - pos = start //匹配失败,位置回退 - return -1 }