Parse an email
indexOf and substring split an email address into the part before and after the @.
Your task
Split two Contact emails at their own @, then spot an email with no @ without throwing.
String email = 'maya.chen@example.com';
Integer atIndex;
String localPart;
String domain;
// Case A: maya.chen@example.com
// Case B: admin@io.dev
email = 'admin@io.dev';
// Case C: no @ at all
email = 'maya.chen.example.com';Requirements
substring,substringBeforeorsubstringAftershould be usedFirst local: maya.chenshould be printedFirst domain: example.comshould be printedSecond local: adminshould be printedSecond domain: io.devshould be printedThird at index: -1should be printedThird valid: falseshould be printed