且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 URL 获取没有子域的域

更新时间:2023-02-26 11:21:29

我知道这已经晚了几年,但如果有人偶然发现这个问题,请尝试以下操作:

I know this is a few years late but if anyone stumbles across this question try the following:

InternetDomainName.from("subhost.example.co.uk").topPrivateDomain().name

以上将返回example.co.uk.

The above will return example.co.uk.