Commit 96ca04f
committed
feat: Add basic email parsing and Gmail domain detection in EmailValidate class
- Prompted user for an email address via Scanner.
- Parsed the email string to:
- Extract the username (substring before '@')
- Extract the domain name (substring after '@')
- Printed both username and domain.
- Checked if domain starts with "Gmail" (case-sensitive).
- Extracted the domain prefix (substring before first '.') and validated if it's "gmail" (case-insensitive).
- Closed Scanner to prevent memory/resource leaks.
Note:
- This version assumes valid email format and does not perform safety checks for missing '@' or '.'.
- Can be improved by adding validation before substring operations to prevent runtime exceptions.
Signed-off-by: Somesh diwan <[email protected]>1 parent 0e21c25 commit 96ca04f
1 file changed
+2
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
| 26 | + | |
0 commit comments