Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • wait... what if there is no subdomain. ie http://example.com, he will get (string) example....
    – Edward
    Commented Jul 20, 2018 at 17:57
  • @Edward he will actually get http://example, so this depends on the input. But this works with what OP gave in his question.
    – Spoody
    Commented Jul 20, 2018 at 18:00
  • 1
    yep, i deleted my answer, because stackoverflow.com/questions/5292937/…
    – Edward
    Commented Jul 20, 2018 at 18:05
  • @Edward the only way we can be sure is with OP's feedback.
    – Spoody
    Commented Jul 20, 2018 at 18:07