I am trying to Compare two strings which are delimited by SEMI-COLUMN (;). I have made sure I SPLIT them and the store them in lists. In the below example, I receive an error for BALL for all other strings in TEST 3 pass. I just need to make sure all of the values in TEST3 are available in TEST2.
Any help is appreciated and would be a big learning curve for me.
STRING TEST1 = 'MY ; BALL ; CAR; PEN';
LIST<STRING> TEST2 = TEST1.SPLIT(';');
SYSTEM.debug(TEST2);
STRING TEST3 = 'MY ; BALL; CAR';
for(string test4:TEST3.split(';')){
system.debug(test4);
if(TEST2.contains(test4)){
system.debug('working');
system.debug(test2);
}
else{
system.debug('not working');
}
}