有什么简单的方法可以做到这一点? [英] What's an easy way to do this?
本文介绍了有什么简单的方法可以做到这一点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够获取任何URL并获得它的根。
例如:
http://msdn.microsoft.com/blah/blah/blah
将返回:
microsoft.com
是否有一个类可以执行此操作?
谢谢!
解决方案
您可以使用Uri课程。
>
Dim myUri As New Uri(" http://msdn.microsoft.com/blah/blah/blah")
Dim strTemp As String = myUri.Host
strTemp将包含msdn.microsoft.com
" vbMark" < no@email.com>在消息中写道
news:Xn ************************ @ 130.133.1.4 ...
我希望能够获取任何URL并获得它的根。
例如:
http://msdn.microsoft.com/blah/blah/blah
返回:
microsoft.com
是否有一个课程会这样做?
谢谢!
只要存在''http://'',分拆(url," //")(1)肯定会这样做吗?
>
Jeff Law
新西兰
" vbMark" < no@email.com>在消息中写道
news:Xn ************************ @ 130.133.1.4 ...
我希望能够获取任何URL并获得它的根。
例如:
http://msdn.microsoft.com/blah/blah/blah
返回:
microsoft.com
是否有一个课程会这样做?
谢谢!
你可以使用Uri类..
Dim myUri As New Uri(" http://msdn.microsoft.com/blah/blah / blah")
Dim strTemp As String = myUri.Host
strTemp将包含msdn.microsoft.com
vbMark < no@email.com>在消息中写道
news:Xn ************************ @ 130.133.1.4 ...
我希望能够获取任何URL并获得它的根。
例如:
http://msdn.microsoft.com/blah/blah/blah
返回:
microsoft.com
是否有一个课程会这样做?
谢谢!
I want to be able to take any URL and get its root.
For example:
http://msdn.microsoft.com/blah/blah/blah
Would return:
microsoft.com
Is there a class that will do this?
Thanks!
解决方案
You could use the Uri class..
Dim myUri As New Uri("http://msdn.microsoft.com/blah/blah/blah")
Dim strTemp As String = myUri.Host
strTemp would contain "msdn.microsoft.com"
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4...
I want to be able to take any URL and get its root.
For example:
http://msdn.microsoft.com/blah/blah/blah
Would return:
microsoft.com
Is there a class that will do this?
Thanks!
As long as the ''http://'' is present, surely Split(url, "//")(1) would do it?
Jeff Law
New Zealand
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4...
I want to be able to take any URL and get its root.
For example:
http://msdn.microsoft.com/blah/blah/blah
Would return:
microsoft.com
Is there a class that will do this?
Thanks!
You could use the Uri class..
Dim myUri As New Uri("http://msdn.microsoft.com/blah/blah/blah")
Dim strTemp As String = myUri.Host
strTemp would contain "msdn.microsoft.com"
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4...
I want to be able to take any URL and get its root.
For example:
http://msdn.microsoft.com/blah/blah/blah
Would return:
microsoft.com
Is there a class that will do this?
Thanks!
这篇关于有什么简单的方法可以做到这一点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文