How to get domain name from a String(如何从字符串中获取域名)
问题描述
我需要你的帮助。我想在我的C#应用程序中将域名从字符串中分离出来。 对此有什么想法吗?
例如:string strURL="http://stackoverflow.com/questions";
并且我需要如下输出 域名:stackoverflow.com
推荐答案
这应该可以工作。
新Uri("http://stackoverflow.com/questions").DnsSafeHost
这篇关于如何从字符串中获取域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!