forked from gumob/TLDExtractSwift
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e5b554
commit 9025713
Showing
2 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
# ```` | ||
# ``TLDExtract`` | ||
|
||
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@--> | ||
Swift package to extract top level domain (TLD), second level domain, subdomain and root domain | ||
|
||
## Overview | ||
|
||
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@--> | ||
```swift | ||
import TLDExtract | ||
|
||
let extractor = TLDExtract() | ||
|
||
let urlString: String = "http://super.duper.domain.co.uk" | ||
guard let result: TLDResult = extractor.parse(urlString) else { return } | ||
|
||
print(result.rootDomain) // Optional("domain.co.uk") | ||
print(result.topLevelDomain) // Optional("co.uk") | ||
print(result.secondLevelDomain) // Optional("domain") | ||
print(result.subDomain) // Optional("super.duper") | ||
``` | ||
|
||
## Topics | ||
|
||
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@--> | ||
### Extracting | ||
|
||
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@--> | ||
- ``TLDExtract/TLDExtract`` | ||
- ``TLDExtractable`` | ||
- ``TLDResult`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters