jakethebot
09-04-2003, 12:37 AM
ok this is what i need a code to extract the third case in this sentance 2,547 Slasher66 2 $1,300 $0 <-- there is like 6 items in 1 sentance, i need the 3rd one :-) please can anyone help i already tried i failed but i did remove the first item in there cause i am gonna have a listbox full of items similar to "2,547 Slasher66 2 $1,300 $0" <-- i just need that 3rd item extracted or how u say splitted.. from the items oh p.s: the whole thing is in one line! its like this "1,000 myname 10 $2,000 $100"
gundavarapu
09-04-2003, 01:04 AM
try this...
'place two command buttons on the form and check the code
Dim str As String
Private Sub Command1_Click()
'method 1
Dim i As Integer
Dim reqstr As String
Do While InStr(str, Space$(1)) > 0
i = i + 1
If i = 1 Then 'replace 1 with what ever you want
reqstr = Mid$(str, InStr(str, Space$(1)) + 1)
reqstr = Left$(reqstr, InStr(reqstr, Space$(1)) - 1)
Exit Do
End If
Loop
MsgBox reqstr
End Sub
Private Sub Command2_Click()
'method two
Dim strarr() As String
strarr = Split(str, Space$(1))
MsgBox strarr(1) 'replace 1 with whatever you want
End Sub
Private Sub Form_Load()
str = "2,547 Slasher66 2 $1,300 $0"
End Sub
This needs some exception handling.
Hope this helps!
jakethebot
09-04-2003, 01:06 AM
HEY IT WORKS THANK YOU! SO MUCH for the first post but the second post il try your method too
Ales Zigon
09-04-2003, 01:08 AM
Something like this, maybe?
Const strOrg As String = "2,547 Slasher66 2 $1,300 $0"
Private Sub Command1_Click()
Dim sBreak() As String
sBreak = Split(strOrg, " ")
Caption = sBreak(1)
End Sub
jakethebot
09-04-2003, 01:13 AM
how the heck did u do that (second poster for method) thats neat, lol i forgot my own vb skills, i use to be able to similar stuff like this :-( its been all those game i been playing! btw i am 15 yrs old i can make a proxy clicker u load a list like..... that has ip:port <- format and it extracts the ip from the port seperated so winsock can connect! :-D that was hard at first then i finally got it! lol and i learned proxies so :-p thank you for all your turtiols for help with this !!! re-teaching me lol