extractDomain 🌶️🌶️🌶️ Extra
Write a method that takes one String parameter, url, and returns just its domain. A url always starts with "http://" or "https://", followed by the domain, optionally followed by a "/" and a path. For example, extractDomain("https://www.example.com/page") should return "www.example.com", and extractDomain("https://example.com") (no path at all) should return "example.com". You may assume url always contains "://" exactly once.
Hint: you do not have an if statement available yet, so a url with no path at all needs to work through the same straight-line code as one with a path — try appending an extra "/" to url before you search for anything, so there is always at least one "/" to find after the domain.
Is there a method that finds where "://" is? Does the domain start right there, or a few characters later?
What if there's no "/" after the domain at all? Could you guarantee one exists before you search?