parse static method

MailTo parse(
  1. String mailtoString
)

Implementation

static MailTo parse(String mailtoString){
  final line=mailtoString.split(':');
  if(line.length==2 && line[0]=='mailto' && Heplers.isValidEmail(line[1].trim().replaceAll(',', ''))){
    return MailTo(line[1].trim().replaceAll(',', ''));
  }else if(Heplers.isValidEmail(line[0].trim().replaceAll(',', ''))){
      return MailTo(line[0].trim().replaceAll(',', ''));
  }
  throw 'Invalid MailTo format';
}