Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This one should be simple...

Status
Not open for further replies.

bobbyr

Programmer
Nov 30, 2000
66
US
OK.. I'm not with it today. I'm looking for the best way to remove the host out of a domain:

example, take or mail.oitweb.com and write just oitweb.com.

Thanks in advance!
 
You can use Split then recombine all the elements after the first.
Code:
x=Split("mail.oitweb.com",".") 'splits into array on '.'
For a = 1 to Ubound(x)   'loop thro array missing element 0
y=y & x(a) & "."         'add elements and '.'
Next
y=Left(y,Len(y)-1)       'remove spare '.' at the end
Msgbox y

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
This will do it for you:

Code:
Dim MyString
Dim MyNewString

MyString = "[URL unfurl="true"]www.tek-tips.com"[/URL]
MyNewString = (Mid((MyString), InStr(1, MyString, ".") + 1))

cheers

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top