I'm getting conditions in an string.
For example: String conditions = "gender == 1 && gender == 3";
I want to convert it into If Conditional statement.
like if(gender == 1 && gender == 3) { }
How can I parse that string ?
I'm getting conditions in an string.
For example: String conditions = "gender == 1 && gender == 3";
I want to convert it into If Conditional statement.
like if(gender == 1 && gender == 3) { }
How can I parse that string ?
You can use function_tree package to convert string to expression.
String conditions = "gender == 1 && gender == 3";
if(conditions.interpret()) { }