PDA

Click to See Complete Forum and Search --> : Seperating a string


Gumppy
Nov 28th, 1999, 05:53 AM
Yes, im trying to seperate a string which just so happens to be a Ip. I want to be able to set some of the ip into a variable. Like lets say the ip is 123.32.21.12 How would u take out the 123.32.21. part and store it in a variable. Please Help

Compwiz
Nov 28th, 1999, 06:11 AM
Try something like this: (IF you have VB6)

Private Sub Command1_Click()
Dim ipParts() As String
ipParts = Split("192.168.1.1", ".", -1, vbTextCompare)
MsgBox "The First Part is: " & ipParts(0) & "." & ipParts(1) & "." & ipParts(2) & "."
End Sub

------------------
Tom Young, 14 Year Old
tyoung@stny.rr.com
ICQ: 15743470 (http://wwp.icq.com/15743470) Add Me (http://wwp.icq.com/scripts/search.dll?to=15743470) ICQ Me (http://wwp.icq.com/scripts/contact.dll?msgto=15743470)
AIM: TomY10 (http://www.aol.com/aim/aim30.html)
PERL, JavaScript and VB Programmer

[This message has been edited by Compwiz (edited 11-28-1999).]

Gumppy
Nov 28th, 1999, 06:32 AM
That worx with the ip directly but is there a way to retrieve the ip from the textbx and then have it use it because when i trie to do that it doesnt wnat to work

Compwiz
Nov 28th, 1999, 06:45 AM
Just change
ipParts = Split("192.168.1.1", ".", -1, vbTextCompare)

to
ipParts = Split(Text1.Text, ".", -1, vbTextCompare)

or whatever the textbox's name is.