Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add substring check for IfElse plugins #7

Open
kamakazikamikaze opened this issue Nov 21, 2024 · 0 comments
Open

Comments

@kamakazikamikaze
Copy link

The plugins will perform full-string comparison actions. However there are times when performing a substring check is beneficial.

This issue requests that a substring option be added to the logic of the compareString method:

private String compareString(String operator, String testValue, String comparisonValue) {
if (operator.equals(STRING_BEG) && testValue.startsWith(comparisonValue)) {
return STRING_BEG;
} else if (operator.equals(STRING_END) && testValue.endsWith(comparisonValue)) {
return STRING_END;
}
int compare = testValue.compareTo(comparisonValue);
if (operator.equals(STRING_LT) && compare < 0) {
return STRING_LT;
} else if (operator.equals(STRING_LE) && compare <= 0) {
return STRING_LE;
} else if (operator.equals(STRING_GE) && compare >= 0) {
return STRING_GE;
} else if (operator.equals(STRING_GT) && compare > 0) {
return STRING_GT;
}
return "";

Logic could be added to check if operator.equals(STRING_SUB), and if so, enter a different block than lines 145-154, where testValue.contains(comparisonValue) is executed and the result checked for the appropriate return value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant