从网址分离域名 [英] Seperate Domain name from url
问题描述
嗨朋友们..
我有一张桌子上面有以下.....字段
URL
域名
域名具有以下后缀
..edu,.com,.org,.ca.org等;
列中的数据如下所示。
URL
=========== =
http://www.test1.com/contact.asp
http://www.test2.edu/ddd.asp
http://www.test3.co.in /ct.php
http:// dsih。 test4.co.uk/test.html
""
""
如何我可以从以下列表中提取唯一的域名吗?到
给出以下输出?
域名
=========
test1.com
test2.edu
test3.co.in
test4.co.uk
"
"''
问候
Ganesh J. Acharya
URL
============
< a rel =nofollowhref =http://www.test1.com/contact.asptarget =_ blank> http://www.test1.com/contact.asp
http://www.test2.edu/ddd.asp
http://www.test3.co.in/ct.php
http://dsih.test4.co.uk/ test.html
如何从以下列表中提取唯一的域名?到
给出以下输出?
域名
=========
test1.com
test2.edu
test3.co.in
test4.co.uk
使用以下代码作为示例:
Dim strURL As String
Dim strDomain As String
Dim intPos as Integer
strURL = http://www.test2.edu/ddd.asp
intPos = InStr(8,strURL," /",vbTextCompare)
strDomain = Mid(strURL,8,intPos - 7)
-
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype:pbsoftsolution
< blockquote>你好不要认为这解决了问题....
如果字符串是 http://子域名.test123.com / testpage.html
您好
您好Don 我认为这可以解决问题....
如果字符串是 http://subdomain.test123.com/testpage.html
试试这个:
函数SeparateDomain(strDomain As String)As String
Dim i As Long,j As Long,k As Long
k = InStr (1,strDomain," //")+ 2
i = InStr(1,strDomain,"。")
j = InStr(k,strDomain, " /")
SeparateDomain = Mid(strDomain,i + 1,(j - i) - 1)
结束函数
问候
Jens
Hi friends..
I have a table with the following ..... fields
URL
Domain
The domain name has the following suffix
..edu, .com, .org, .ca.org etc;
the data in the column looks as follows.
URL
============
http://www.test1.com/contact.asp
http://www.test2.edu/ddd.asp
http://www.test3.co.in/ct.php
http://dsih.test4.co.uk/test.html
""
""
How can I extract the only the domain name from the following list? to
give the following output?
Domain
=========
test1.com
test2.edu
test3.co.in
test4.co.uk
""
"''
Regards
Ganesh J. Acharya
URL============
http://www.test1.com/contact.asp
http://www.test2.edu/ddd.asp
http://www.test3.co.in/ct.php
http://dsih.test4.co.uk/test.html
How can I extract the only the domain name from the following list? to
give the following output?
Domain
=========
test1.com
test2.edu
test3.co.in
test4.co.ukUse the following code as an example:
Dim strURL As String
Dim strDomain As String
Dim intPos As Integer
strURL = http://www.test2.edu/ddd.asp
intPos = InStr(8, strURL, "/", vbTextCompare)
strDomain = Mid(strURL, 8, intPos - 7)
--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
Hi Don''t think that solves the problem....
what if the string is http://subdomain.test123.com/testpage.html
Hi
Hi Don''t think that solves the problem....
what if the string is http://subdomain.test123.com/testpage.htmlTry this :
Function SeparateDomain(strDomain As String) As String
Dim i As Long, j As Long, k As Long
k = InStr(1, strDomain, "//") + 2
i = InStr(1, strDomain, ".")
j = InStr(k, strDomain, "/")
SeparateDomain = Mid(strDomain, i + 1, (j - i) - 1)
End Function
Regards
Jens
这篇关于从网址分离域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!