Skip to content

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

Description

@kamakazikamikaze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions