Skip to content

Commit

Permalink
Merge pull request #88 from abes-esr/develop
Browse files Browse the repository at this point in the history
[bug] il faut échapper le OR
  • Loading branch information
julg authored May 31, 2024
2 parents c301784 + 7d80a74 commit a7ad403
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private String replaceSpacesOutsideQuotes(String input) {
boolean insideQuotes = false;
boolean insideBrackets = false;


for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);

Expand All @@ -120,11 +121,22 @@ private String replaceSpacesOutsideQuotes(String input) {
} else if (c == ']') {
insideBrackets = false;
result.append(c);
} else if (c == ' ' && !insideQuotes && !insideBrackets) {
result.append(" AND ");
}
else if (c == ' ') {
if (i + 2 < input.length() && input.charAt(i + 1) == 'O'&& input.charAt(i + 2) == 'R') {

result.append(" OR ");
i+= 3;
} else if (!insideQuotes && !insideBrackets) {
result.append(" AND ");
} else {
result.append(c);
}
} else {
result.append(c);

}

}

return result.toString();
Expand Down

0 comments on commit a7ad403

Please # to comment.