Split and join text
split returns a List<String> and reads its argument as regex, so a real dot is '\\.'.
Your task
Turn a multi-select picklist value into a List, add one value, and join it. Then split a My Domain host on its dots.
String source = 'Enterprise;Renewal;EMEA';
List<String> parts;
// Case A: split the picklist value and add Upsell
// Case B: a single picklist value
source = 'Renewal';
// Case C: split a My Domain host on its dots
String host = 'acme.my.salesforce.com';Requirements
split(should be usedString.join(should be usedCount: 4should be printedDisplay: Enterprise, Renewal, EMEA, Upsellshould be printedSingle count: 1should be printedSingle display: Renewalshould be printedHost parts: 4should be printed