formatAtSign method

String? formatAtSign(
  1. String? atsign
)

Returns null if atsign is null else the formatted atsign. atsign must be non-null.

Implementation

String? formatAtSign(String? atsign) {
  if (atsign == null) {
    return null;
  } else if (atsign.contains(':')) {
    return Strings.invalidAtsign;
  }
  atsign = atsign.trim().toLowerCase().replaceAll(' ', '');
  atsign = !atsign.startsWith('@') ? '@' + atsign : atsign;
  return atsign;
}