Refactoring

This commit is contained in:
M66B 2023-12-28 18:31:14 +01:00
parent 3b0c0a693a
commit 61ae7f6e2e
1 changed files with 8 additions and 4 deletions

View File

@ -71,8 +71,10 @@ public class Adguard {
continue;
}
String expr = line.substring(0, dollar).replace("\\$", "$");
String rest = line.substring(dollar + 1).replace("\\$", "$");
String expr = line.substring(0, dollar)
.replace("\\$", "$");
String rest = line.substring(dollar + 1)
.replace("\\$", "$");
List<String> commands = new ArrayList<>();
int start = 0;
@ -81,7 +83,8 @@ public class Adguard {
while (comma > 0 && rest.charAt(comma - 1) == '\\')
comma = rest.indexOf(',', comma + 1);
int end = (comma < 0 ? rest.length() : comma);
commands.add(rest.substring(start, end).replace("\\,", ","));
commands.add(rest.substring(start, end)
.replace("\\,", ","));
start = (comma < 0 ? end : end + 1);
}
@ -104,7 +107,8 @@ public class Adguard {
while (pipe > 0 && e.charAt(pipe - 1) == '\\')
pipe = e.indexOf('|', pipe + 1);
int end = (pipe < 0 ? e.length() : pipe);
domains.add(e.substring(start, end).replace("\\|", "|"));
domains.add(e.substring(start, end)
.replace("\\|", "|"));
start = (pipe < 0 ? end : end + 1);
}