From 068814b8ad3fdadc6df6144f6ce15ec625d18d2d Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Tue, 15 Oct 2024 15:39:28 +0200 Subject: [PATCH] feat: add function to get email domain --- src/EMail.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/EMail.java b/src/EMail.java index aad9586..f6420c4 100644 --- a/src/EMail.java +++ b/src/EMail.java @@ -14,4 +14,13 @@ public class EMail { // Checks and returns if the email matches the regex pattern 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]; + } }