13 1093
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!
Don't know about a class that does this for you, but some string
manipulation would get you there.
Dim wholeURL As String = "http://www.microsoft.com/"
Dim baseURL As String = wholeURL.Substring(wholeURL.IndexOf("//") + 2,
wholeURL.IndexOf("/", 7) - 7)
baseURL = Right(baseURL, baseURL.Length - baseURL.IndexOf(".") - 1)
Response.Write(baseURL)
"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!
That's very close but I just want the microsoft.com part. I don't see a
method for that. Am I just missing it?
"Brian" <do****@howser.com> wrote in news:b0bQc.35889$Gk4.5544
@fe1.texas.rr.com: 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!
AFAIK, I don't think there is a method for that. You'd just have to
manipulate the string, splitting it at periods "." or something.
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4... That's very close but I just want the microsoft.com part. I don't see a method for that. Am I just missing it?
"Brian" <do****@howser.com> wrote in news:b0bQc.35889$Gk4.5544 @fe1.texas.rr.com: 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!
AFAIK, I don't think there is a method for that. You'd just have to
manipulate the string, splitting it at periods "." or something.
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4... That's very close but I just want the microsoft.com part. I don't see a method for that. Am I just missing it?
"Brian" <do****@howser.com> wrote in news:b0bQc.35889$Gk4.5544 @fe1.texas.rr.com: 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!
That wouldn't strip off information after the domain name though.
"Jeff Law" <je*****@datamasta.co.nz> wrote in message
news:e8****************@TK2MSFTNGP11.phx.gbl... 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!
AFAIK, I don't think there is a method for that. You'd just have to
manipulate the string, splitting it at periods "." or something.
SORRY if I double/triple posted. My news server is saying that my message
is deleted right after I post it. Wtf.
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4... That's very close but I just want the microsoft.com part. I don't see a method for that. Am I just missing it?
"Brian" <do****@howser.com> wrote in news:b0bQc.35889$Gk4.5544 @fe1.texas.rr.com: 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!
Here is my solution:
Dim myUri As New Uri(sURI)
sTemp = myUri.Host
sSplit = sTemp.Split(".")
sTemp = sSplit(sSplit.GetUpperBound(0) - 1) & _
"." & sSplit(sSplit.GetUpperBound(0))
MsgBox(sTemp)
Let me know what you think.
vbMark <no@email.com> wrote in 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!
This does the trick for me:
Dim myURI As New Uri("http://msdn.microsoft.com/blah/blah/blah")
Dim strURI As String = myURI.Host.ToString
strURI = Right(strURI, strURI.Length - strURI.IndexOf(".") - 1)
strURI now is: microsoft.com
"vbMark" <no@email.com> wrote in message
news:Xn************************@130.133.1.4... Here is my solution:
Dim myUri As New Uri(sURI) sTemp = myUri.Host sSplit = sTemp.Split(".") sTemp = sSplit(sSplit.GetUpperBound(0) - 1) & _ "." & sSplit(sSplit.GetUpperBound(0)) MsgBox(sTemp)
Let me know what you think.
vbMark <no@email.com> wrote in
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!
Scott,
Two "problems" :-)
1) I would avoid mixing VB.Strings (Right) with String (IndexOf, Length) I
would recommend using one or the other, then you avoid any potential off by
one problems (do I need to include -1 or don't I). As Right expects a base 1
index, while IndexOf returns a base 0 index.
2) what happens with urls such as: http://lab.msdn.microsoft.com/vs2005/
Hope this helps
Jay
"Scott M." <s-***@nospam.nospam> wrote in message
news:OE**************@tk2msftngp13.phx.gbl... This does the trick for me:
Dim myURI As New Uri("http://msdn.microsoft.com/blah/blah/blah") Dim strURI As String = myURI.Host.ToString strURI = Right(strURI, strURI.Length - strURI.IndexOf(".") - 1)
strURI now is: microsoft.com
"vbMark" <no@email.com> wrote in message news:Xn************************@130.133.1.4... Here is my solution:
Dim myUri As New Uri(sURI) sTemp = myUri.Host sSplit = sTemp.Split(".") sTemp = sSplit(sSplit.GetUpperBound(0) - 1) & _ "." & sSplit(sSplit.GetUpperBound(0)) MsgBox(sTemp)
Let me know what you think.
vbMark <no@email.com> wrote in 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!
I don't have a problem using "Right" and "IndexOf". They are both valid and
both have a purpose.
You are correct, though, about the longer domain name, so here is a solution
that works for all:
Dim myURI As New Uri("http://lab.msdn.microsoft.com/vs2005/")
Dim strURI As String = myURI.Host.ToString
Dim urlPart As String() = strURI.Split(CType(".", Char))
strURI = CType(urlPart(urlPart.Length - 2), String) & "." &
CType(urlPart(urlPart.Length - 1), String)
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O7**************@TK2MSFTNGP10.phx.gbl... Scott, Two "problems" :-)
1) I would avoid mixing VB.Strings (Right) with String (IndexOf, Length) I would recommend using one or the other, then you avoid any potential off
by one problems (do I need to include -1 or don't I). As Right expects a base
1 index, while IndexOf returns a base 0 index.
2) what happens with urls such as:
http://lab.msdn.microsoft.com/vs2005/
Hope this helps Jay
"Scott M." <s-***@nospam.nospam> wrote in message news:OE**************@tk2msftngp13.phx.gbl... This does the trick for me:
Dim myURI As New Uri("http://msdn.microsoft.com/blah/blah/blah") Dim strURI As String = myURI.Host.ToString strURI = Right(strURI, strURI.Length - strURI.IndexOf(".") - 1)
strURI now is: microsoft.com
"vbMark" <no@email.com> wrote in message news:Xn************************@130.133.1.4... Here is my solution:
Dim myUri As New Uri(sURI) sTemp = myUri.Host sSplit = sTemp.Split(".") sTemp = sSplit(sSplit.GetUpperBound(0) - 1) & _ "." & sSplit(sSplit.GetUpperBound(0)) MsgBox(sTemp)
Let me know what you think.
vbMark <no@email.com> wrote in 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!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Doe. |
last post by:
Hi PHP gurus!
Our team will be creating a web-application that must have an easy to use
programmatic interface for our web-developer clients. The data transferred
will primarily be taken from a...
|
by: Chris Cioffi |
last post by:
I started writing this list because I wanted to have definite points
to base a comparison on and as the starting point of writing something
myself. After looking around, I think it would be a...
|
by: Philippe C. Martin |
last post by:
I apologize in advance for launching this post but I might get enlightment
somehow (PS: I am _very_ agnostic ;-).
- 1) I do not consider my intelligence/education above average
- 2) I am very...
|
by: Crimarc |
last post by:
I come back to ask qustion what did he promised you that you soudned
so much happy and sometime later so painful like you heart broken
becase of his dificults ???? What did you sacrifice for C++...
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode...
|
by: WindAndWaves |
last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.
I can understand that it may lead to confusing code, but I often use it like
this:
is this...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
|
by: Friendly_Lola |
last post by:
What Screen Resolution do You use?
800 X 600
1024 X 768
1280 X 1024 Wow!
1600 X 1200 (i can't imagine this)
I use 1024 X 768.
For what resolution you optimize your web pages?
|
by: lovecreatesbea... |
last post by:
Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?
And what are its...
|
by: Stef Mientki |
last post by:
hello,
I (again) wonder what's the perfect way to store, OS-independent,
filepaths ?
I can think of something like:
- use a relative path if drive is identical to the application (I'm
still a...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |