PDA

Click to See Complete Forum and Search --> : Seperating two parts of the proxy


ca1n3
Mar 26th, 2001, 06:51 AM
This could probably be posted in the regular vb forum, but it deals with proxies.. so what the hey.

I have my proxy loaded into a text box like this:
34.343.343.23:80
All i need to know is how to split up the two parts to put into seperate text boxes.

For example:
text1.text would have: 34.343.343.23:80
therefore proxy.text would have 34.343.343.23
and port.text would have: 80


thanks for the help guys

VorTechS
Mar 26th, 2001, 07:50 AM
INSTR allows you to find a specific character within a string and returns the character's position.

So something like:

Dim lngColonPos as long


lngColonPos = instr(1,text1.text,":",vbtextcompare)

'This should return the server IP
proxy.text = left$(text1.text, lngcolonpos -1)

'This should return just the port
port.text = mid$(text1.text, lngcolonpos +1)

--------------------------------------------------------------

Outta do it .... you may need to do checks of course, ie that the user actually did use a colon to separate the port etc...

Hope this helps - if not - heh, sorry I must of mis-understood the question...

harsoni
Mar 26th, 2001, 08:37 AM
Use the Split function in VBSCRIPT


Ex:

Dim str
str = Split("34.343.343.23:80", ":", -1, 1)
proxy.text = str(0)
port.text = str(1)

Hope this helps

Sonia