|
-
Nov 4th, 2000, 03:52 AM
#1
Thread Starter
Lively Member
373 3 3 113 "hello there" "sup all" 4 4
i need to parse out the first 4 strings then parse out the words in ""s, but at the same time keeping there spacing, and then parse out the last 2 strings so that it comes out as:
373
3
3
113
hello there
sup all
4
4
-
Nov 4th, 2000, 04:34 AM
#2
Hyperactive Member
How is the Information stored ? In a file or a String ? I'm going to assume it's in a string . I'm also going to assume your using VB6 . Try something like this .
Code:
Dim ParsedData( )
Dim Data as String
If Trim(Data) <> "" And InStr(1, Data, ":") Then
ParsedData = Split(Data, " ", -1)
You can Then Access the elements of the parsedData array like . This will return element 1 .
Code:
msgbox parsedData(0)
Hope that helped a little . I just woke up .
[]P
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Nov 4th, 2000, 04:37 AM
#3
Thread Starter
Lively Member
-
Nov 4th, 2000, 04:44 AM
#4
Hyperactive Member
Scorpionz ,
I Don't think the split function is in VB5 , I Don't know another way to do it .
Sorry ,
[]P
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Nov 4th, 2000, 07:45 AM
#5
transcendental analytic
Here's mysplit by Iain, it should work almost the same (you pass the array instead) as split except it's a lot faster for larger arrays 
Code:
Private Sub Mysplit(Source, searchs As String, ByRef Arr() As String)
Dim pos As Long, pos2 As Long, x As Long
pos = 0
If Right(Source, Len(searchs)) = searchs Then
Source = Mid(Source, 1, Len(Source) - Len(searchs))
End If
Do
pos = InStr(pos + 1, Source, searchs, vbTextCompare)
If pos = 0 Then Exit Do
ReDim Preserve Arr(x)
Arr(x) = Mid(Source, pos + 1, pos + Len(searchs) - 2)
x = x + 1
Loop
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 4th, 2000, 09:08 AM
#6
Fanatic Member
Change all that to Right$ instead of Right and Mid$ instead of Mid -- and Left$ instead if Left, for that matter.
Appending the $ suffix -- for some reason -- makes VB 5 apps perform better after compilation.
And, hey keda .. no offense
-
Nov 4th, 2000, 09:58 AM
#7
transcendental analytic
Well it's Iains, so it's np, but in Vb6, some of those just disappear
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 4th, 2000, 03:25 PM
#8
Hyperactive Member
the $ thing is odd; is it that right$ etc are especially for strings, whereas right, etc take a variant?
buzzwords are the language of fools
-
Nov 4th, 2000, 03:35 PM
#9
Thread Starter
Lively Member
grrrrrrrrrrrr
ok, none of this is working out properly... =\
-
Nov 4th, 2000, 03:52 PM
#10
Just use this code from Megatron, rearrange it around and you get:
Code:
Private Function RemoveText(ByVal Text As String) As String
'from Megatron
Dim i As Integer
Dim bInTag As Boolean
Dim strTmpStr As String
bInTag = False
For i = 1 To Len(Text)
If Not bInTag Then
If Mid(Text, i, 1) <> """" Then
strTmpStr = strTmpStr & Mid(Text, i, 1)
Else
bInTag = True
End If
Else
If Mid(Text, i, 1) = """" Then
bInTag = False
End If
End If
Next
RemoveText = strTmpStr
End Function
Private Sub Command1_Click()
Dim strString As String
strString = "373 3 3 113 ""hello there"" ""sup all"" 4 4"
MsgBox RemoveText(strString)
End Sub
-
Nov 4th, 2000, 04:03 PM
#11
Thread Starter
Lively Member
about to give up =\
yes, that would work, but i would want the string to be added to a listbox as so:
373
3
3
113
hello there
sup all
4
4
-
Nov 4th, 2000, 05:58 PM
#12
Hyperactive Member
Yeah, so after that, use the split kedaman suggested.
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
|