fix: improve comments

This commit is contained in:
2026-04-17 11:53:06 +03:30
parent 3ac2a41574
commit 5780e034f1
3 changed files with 62 additions and 32 deletions
+21 -4
View File
@@ -7,6 +7,17 @@ public class BonusExercises {
/*
complete the method below, so it will validate an email address
1. Must have exactly one @ (no more, no less)
2. Split into local-part and domain (before @ and after @)
3. Local-part rules:
- Can't be empty
- Can't start or end with dot
- Can't have two dots in a row
4. Domain rules:
- Can't be empty
- Can't start or end with hyphen
- Can't have underscores
- Each segment (between dots) must follow same hyphen rules
*/
public boolean validateEmail(String email) {
String regex = ""; // todo
@@ -17,10 +28,16 @@ public class BonusExercises {
}
/*
this method should find a date in string
note that it should be in british or american format
if there's no match for a date, return null
*/
This method should find and return the first date in a string.
Supported formats:
- American: MM/DD/YYYY (e.g., 12/09/2023)
- British: DD/MM/YYYY (e.g., 12/09/2023 — same pattern, context matters)
- ISO: YYYY-MM-DD (e.g., 2024-07-15)
- Slash variant: YYYY/MM/DD (e.g., 2025/01/01)
If no match for a date is found in the string, return null.
*/
public String findDate(String string) {
// todo
return null;