feat: add function to get email domain

This commit is contained in:
Anthony Berg 2024-10-15 15:39:28 +02:00
parent c37111f7a5
commit 068814b8ad

View File

@ -14,4 +14,13 @@ public class EMail {
// Checks and returns if the email matches the regex pattern // Checks and returns if the email matches the regex pattern
return pattern.matcher(email).matches(); return pattern.matcher(email).matches();
} }
/**
* Retrieves the domain part of the email address
* @param email A valid email address
* @return The domain of the email address from the parameter
*/
public String getDomain(String email) {
return email.split("@")[1];
}
} }