Commit 68efeb2
committed
feat: Identify website protocol and domain type from URL input
🧠 Logic:
- User enters a full URL string (e.g., `http://example.com`).
- Protocol is extracted using `substring(0, indexOf(":"))`:
- If `http` → prints "Hypertext Transfer Protocol"
- If `ftp` → prints "File Transfer Protocol"
- Else → prints "Unknown protocol"
- Domain extension is extracted using `substring(lastIndexOf(".") + 1)`:
- If `com` → prints "Commercial website"
- If `org` → prints "Organization website"
- If `net` → prints "Network website"
- Else → prints "Unknown website type".
Signed-off-by: Somesh diwan <[email protected]>1 parent 8f41468 commit 68efeb2
File tree
1 file changed
+9
-15
lines changed- Section7ConditionalStatements/src
1 file changed
+9
-15
lines changedLines changed: 9 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | | - | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
69 | | - | |
| 66 | + | |
70 | 67 | | |
71 | 68 | | |
72 | | - | |
73 | | - | |
| 69 | + | |
74 | 70 | | |
75 | 71 | | |
76 | | - | |
77 | | - | |
| 72 | + | |
78 | 73 | | |
79 | 74 | | |
80 | | - | |
81 | | - | |
| 75 | + | |
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
| |||
0 commit comments