ApexSensei

Drills Apex basics

Quick win: make initials

Text has built-in methods.

Your task

Fill in the body of initials so it returns the first letter of each name as capitals, joined with +.

String initials(String first, String last) {
    return null;
}

Requirements

  1. initials('jane', 'doe') should be JD
  2. initials('Ana', 'Silva') should be AS
  3. initials('m', 'o') should be MO
  4. initials(<hidden>) should be the two capital initials
  5. initials('', 'doe') should be D

Sign in to open this drill