|
-
Feb 19th, 2005, 04:37 AM
#1
Thread Starter
Addicted Member
Split String
Hi,
How can i read 3 strings behind a word.
Example: !Connect Serv 1204 Pass
Then how can i split it so i can read
the 3 words behind !Connect and i can put
them in a string
serv = Serv
Port = 1204
Pass = Pass
Srry for my bad english, im from holland
Code i have:
VB Code:
If Left(Message, 7) = "!Connect" Then
Dim String As String
a = Message
b = " "
If Left(a, 7) = "!Connect" Then
c = Split(a, b)
String = c(1)
sendmsg string
End If
End If
In the code above, i can only get 1 string behind the word
thx !
Last edited by Tha Joey Madnez; Feb 19th, 2005 at 05:00 AM.
-
Feb 19th, 2005, 04:40 AM
#2
Re: Split String
 Originally Posted by Tha Joey Madnez
Hi,
How can i read 3 strings behind a word.
Example: !Connect Serv 1204 Pass
Then how can i split it so i can read
the 3 words behind !Connect and i can put
them in a string
serv = Serv
Port = 1204
Pass = Pass
Srry for my bad english, im from holland
Code i have:
VB Code:
If Left(Message, 7) = "!Connect" Then
Dim String As String
a = Message
b = " "
If Left(a, 7) = "!Connect" Then
c = Split(a, b)
String = c(1)
sendmsg string
End If
End If
In the code above, i can only get 1 string behind the word
thx ! 
VB Code:
myString = "!Connect Serv 1204 Pass"
myArray = Split(mystring, " ")
MsgBox myarray(0) ' would contain !Connect
MsgBox myarray(1)
MsgBox myarray(2)
Msgbox MyArray(3)
and whalla there stored in the array 
Hope that helps
Edit - for your code....
VB Code:
If Left(Message, 7) = "!Connect" Then
Dim myString As String
a = Message
If Left(a, 7) = "!Connect" Then
c = Split(a, " ")
myString = c(1) ' this would hold port
sendmsg mystring
End If
End If
Last edited by Pino; Feb 19th, 2005 at 04:44 AM.
-
Feb 19th, 2005, 04:50 AM
#3
Thread Starter
Addicted Member
-
Feb 19th, 2005, 04:58 AM
#4
Re: Split String
 Originally Posted by Tha Joey Madnez
Edit: I dint saw the code beneath it, i will test now
THX For reply !
But it doesnt work with me 
Show me the code you are using?
VB Code:
myString = "!Connect Serv 1204 Pass"
MyArray = Split(myString, " ")
MsgBox MyArray(0) ' would contain !Connect
MsgBox MyArray(1) 'contains the serv
MsgBox MyArray(2) 'contains the port
MsgBox MyArray(3) 'contains the pass
use that to impliment into your app.
Let me see your code.
-
Feb 19th, 2005, 05:00 AM
#5
Thread Starter
Addicted Member
Re: Split String
I got it to work 
I forgot something,
this dint work because of the 7, connect contains 8 characters 
VB Code:
If Left(Message, 7) = "!Connect" Then
This works
VB Code:
If Left(Message, 8) = "!Connect" Then
Thx
-
Feb 19th, 2005, 05:05 AM
#6
Re: Split String
 Originally Posted by Tha Joey Madnez
I got it to work 
I forgot something,
this dint work because of the 7, connect contains 8 characters
VB Code:
If Left(Message, 7) = "!Connect" Then
This works
VB Code:
If Left(Message, 8) = "!Connect" Then
Thx 
Arr ok no problem glad you solved it. If you are curious of functions like this have a look in my sig on useful vb functions i have a few covered there.
If you could mark this resolved that would be great
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|