Boolean b1 = true;
Boolean b2 = true;
String b3 = 'b1 && b2';
Boolean b4 = Boolean.valueOf(b3);
system.debug('test Bool '+ b4);
Given a string how can you convert into expression without breaking the sting.
Given a string how can you convert into expression without breaking the sting. |
|||||||
|
|
I think what you're after doing is creating an expression as a string and then evaluating it and obtaining the result in Apex. I don't think it is actually possible to evaluate expressions in Apex natively (it would be great if it was, I also wondered the same since we have the Formula functions). I think the best you could do is roll your own expression parser and AND(Boolean, Boolean) function that implements the required behaviour. |
|||||||||||
|
|
Apex takes its string evaluation mechanisms from Java. To find out if two strings match, I would suggest using the equals or equalsIgnoreCase methods.
|
|||||
|
|