Added a static method to normalize an email address.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1835 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -52,6 +52,19 @@ public class MailUtil
|
|||||||
return _emailre.matcher(address).matches();
|
return _emailre.matcher(address).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a normalized form of the specified email address
|
||||||
|
* (everything after the @ sign is lowercased).
|
||||||
|
*/
|
||||||
|
public static String normalizeAddress (String address)
|
||||||
|
{
|
||||||
|
// this algorithm is tolerant of bogus input: if address has no
|
||||||
|
// @ symbol it will cope.
|
||||||
|
int afterAt = address.indexOf('@') + 1;
|
||||||
|
return address.substring(0, afterAt) +
|
||||||
|
address.substring(afterAt).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delivers the supplied mail message using the machine's local mail
|
* Delivers the supplied mail message using the machine's local mail
|
||||||
* SMTP server which must be listening on port 25.
|
* SMTP server which must be listening on port 25.
|
||||||
|
|||||||
Reference in New Issue
Block a user