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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to set a varible, then section variable

Status
Not open for further replies.

mpnut

MIS
Aug 27, 2003
242
I am very VERY new to VBscript and need to know if something is possible. I have found how to set a visiter to a web pages IP address as a variable. Now I need to know if I can only use parts of that variable, to make another variable. To better explain, here's what I'm trying to do. Say the IP address is 10.19.105.200. I need to set a new variable to 905. Taking the 9 from the second octect, and 05 from the third octet. Is this possible?
 
Something like this ?
strIP = "10.19.105.200"
arrIP = Split(strIP, ".")
strNewVariable = Mid(arrIP(1), 2) & Mid(arrIP(2), 2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV, thanks for the response. That didn't do exactly what I needed but definately started me in the right direction. Here's what I ended up with:

mystring = Request.ServerVariables("REMOTE_ADDR")
myarray = Split(mystring, ".")
strNewVariable1 = Split(myarray(1),1,2)
strNewVariable2 = Split(myarray(2),1,2)
locat = strNewVariable1(1) & strNewVariable2(1)

Thanks again for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top