ApexSensei

Drills Apex basics

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

  1. split( should be used
  2. String.join( should be used
  3. Count: 4 should be printed
  4. Display: Enterprise, Renewal, EMEA, Upsell should be printed
  5. Single count: 1 should be printed
  6. Single display: Renewal should be printed
  7. Host parts: 4 should be printed

Sign in to open this drill