How do I compare 2 strings to see if one string contains part of the other.
For example:
Sting1= ‘next holiday is Labor Day’
'String2 = ‘Labor Day’
If string1 contains string2 result returns true
Else
Result returns false
How do I compare 2 strings to see if one string contains part of the other.
For example:
Sting1= ‘next holiday is Labor Day’
'String2 = ‘Labor Day’
If string1 contains string2 result returns true
Else
Result returns false
So is the correct syntax
If you define the value of a variable you tell webCoRE to always initialize it. That result variable should be a boolean one, not string, and it should be given no value at all - leave it not defined
I tried it out of curiosity… same result as what op got.
define
string str1 = ‘Tom’;
string str2 = ‘Tomas’;
end define;
(expression) contains(str1,str2) »»» (boolean) false
Edit: my params backassward… lol
(expression) contains(str2,str1) »»» (boolean) true
Variables that have values are never actually saved anywhere because they are constants. You’re changing your testing procedure completely - too many changes leave the result variable in place, or use log to console in the piston and test it - the evaluation console may not have access to constants because of the reason explained. That should probably be fixed