[SalesForce] how to add multiple values to a custom label and check if string exist or not

I have more than 1 string values which I would like to store to a custom label and write if condition to see if the string value exist in custom label or not.

for example : is it possible to add "Car, Truck" to a custom label and then in the if condition we can check whether the custom label contains "Bike" or not and do the rest of the process in if loop?

Best Answer

You can assign your label value to string and then check if string contains your value

string str = system.label.test;
system.debug('>>>.. '+str);
if(str.contains('Bike')){
    system.debug('>>It has bike');
}