|
-
Feb 1st, 2004, 03:50 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [Solved] VBScript: Split String...
Hi guys,,
I need to split incoming data into seperate items of an array... now in Visual Basic this is easy...
in VBScript: i dunno why but its crapped up.
I need to use it like the following:
VB Code:
Sub wskScript_DataArrival(Index, bytesTotal)
'On Error GoTo ErrHand:
'On Error Resume Next
Dim SplitDataA(), DataArrival(), DataRecieved
Dim i
wskScript(0).GetData DataRecieved, vbString
SplitDataA() = Split(DataRecieved, " ## ")
For i = 1 To UBound(SplitDataA())
DataArrival() = Split(SplitDataA(i), " :$: ")
Select Case DataArrival(0)
only problem is:
when i get to the following code:
VB Code:
SplitDataA() = Split(DataRecieved, " ## ")
i get the following error come up:
Error> 9 - Subscript out of range: 'SplitDataA' on line 145
has anybody got a clue of why this error is coming up?...
i know for a fact data is coming, cuz i added a message box like:
Code:
wskScript(0).GetData DataRecieved, vbString
msgbox DataRecieved
and it come up with:
---------------------------
VBScript
---------------------------
## cmdDL :$: LT ## cmdSN :$: 127.0.0.1
---------------------------
OK
---------------------------
anyone got a clue on dis one?.. its prolly jst the fact of the vb / vbscript differences.... but :shrugs:
Last edited by wpearsall; Feb 1st, 2004 at 04:37 PM.
Wayne
-
Feb 1st, 2004, 03:54 PM
#2
Member
SplitDataA() = Split(DataRecieved, " ## ")
try removing the spaces before and after the # sign..
I hope this Helps !!
Good Luck,
Tom
Microsoft Most Valuable Professional Award [ MVP]. mvp.support.microsoft.com
" When there is the will !!! There is the mind for it !."
-
Feb 1st, 2004, 04:04 PM
#3
Thread Starter
Frenzied Member
i need the spaces.... cant remove em, since they are the seperater between diff things in data which is sent...
-
Feb 1st, 2004, 04:16 PM
#4
Frenzied Member
-
Feb 1st, 2004, 04:17 PM
#5
Frenzied Member
VB Code:
Dim SplitDataA As String
Dim DataArrival As String
Dim i As Integer
Dim j As Integer
SplitDataA = Split(DataRecieved, " ## ")
For i = 0 To UBound(SplitDataA)
DataArrival = Split(SplitDataA(i), " :$: ")
For j = 0 To UBound(DataArrival)
Select Case DataArrival(0)
'do something
Next
Next
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Feb 1st, 2004, 04:33 PM
#6
Hyperactive Member
Dont define SplitDataA or DataArrival as array.
So Should be
VB Code:
Sub wskScript_DataArrival(Index, bytesTotal)
'On Error GoTo ErrHand:
'On Error Resume Next
Dim SplitDataA, DataArrival, DataRecieved
Dim i
wskScript(0).GetData DataRecieved, vbString
SplitDataA = Split(DataRecieved, " ## ")
For i = 1 To UBound(SplitDataA)
DataArrival = Split(SplitDataA(i), " :$: ")
Select Case DataArrival(0)
packetvb
-
Feb 1st, 2004, 04:35 PM
#7
Thread Starter
Frenzied Member
Originally posted by Memnoch1207
VB Code:
Dim SplitDataA As String
Dim DataArrival As String
Dim i As Integer
Dim j As Integer
SplitDataA = Split(DataRecieved, " ## ")
thanks memnock....
fixed ma problem (eh, was a diff between the two langs eh... vb needs (), and vbs dont )
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
|