Skip to content

Commit

Permalink
Update email_validator.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
fredeil authored Nov 9, 2023
1 parent 0d4b267 commit e968709
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/email_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,19 @@ class EmailValidator {
static const String _atomCharacters = "!#\$%&'*+-/=?^_`{|}~";
static SubdomainType _domainType = SubdomainType.None;

// Returns true if the first letter in string c has a 16-bit UTF-16 code unit
// greater than or equal to 48 and less than or equal to 57
// otherwise return false
static bool _isDigit(String c) {
return c.codeUnitAt(0) >= 48 && c.codeUnitAt(0) <= 57;
}

// Returns true if the first letter in string c has a 16-bit UTF-16 code unit
// greater than or equal to 65 and less than or equal to 90 (capital letters)
// or greater than or equal to 97 and less than or equal to 122 (lowercase letters)
// otherwise return false
static bool _isLetter(String c) {
return (c.codeUnitAt(0) >= 65 && c.codeUnitAt(0) <= 90) ||
(c.codeUnitAt(0) >= 97 && c.codeUnitAt(0) <= 122);
}

// Returns true if calling isLetter or isDigit with the same string returns true
// Only returns false if both isLetter and isDigit return false
static bool _isLetterOrDigit(String c) {
return _isLetter(c) || _isDigit(c);
}

// Returns value of allowInternational if the first letter in the string c isnt a
// number or letter or special character otherwise
// return the result of _isLetterOrDigit or _atomCharacters.contains(c)
// which only returns false if both _isLetterOrDigit and _atomCharacters.contains(c)
// returns false
static bool _isAtom(String c, bool allowInternational) {
return c.codeUnitAt(0) < 128
? _isLetterOrDigit(c) || _atomCharacters.contains(c)
Expand Down

0 comments on commit e968709

Please sign in to comment.