Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed May 17, 2020
1 parent 5cb8cce commit 4e3460e
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,23 @@ public String getString(String rule) {
}

if (rules.length == 1) {
if (rule.startsWith("$.")) {
try {
Object object = ctx.read(rule);
if (object instanceof List) {
StringBuilder builder = new StringBuilder();
for (Object o : (List) object) {
builder.append(o).append("\n");
}
result = builder.toString().replaceAll("\\n$", "");
} else {
result = String.valueOf(object);
try {
Object object = ctx.read(rule);
if (object instanceof List) {
StringBuilder builder = new StringBuilder();
for (Object o : (List) object) {
builder.append(o).append("\n");
}
} catch (Exception ignored) {
result = builder.toString().replaceAll("\\n$", "");
} else {
result = String.valueOf(object);
}
} catch (Exception e) {
if (!rule.startsWith("$.")) {
return rule;
}
return result;
} else {
return rule;
}
return result;
} else {
List<String> textS = new ArrayList<>();
for (String rl : rules) {
Expand Down

0 comments on commit 4e3460e

Please sign in to comment.