|
-
Jul 5th, 2007, 01:36 PM
#1
Thread Starter
Hyperactive Member
Parsing Data
Hi, I have a string that my program is receiving that is in the following format:
xxxxx;xxxxx;xxx;xxx;xxx;xxxx;0
There is 6 series of numbers (of varying lengths)...divided by a semicolon...and then ending with a ;0.
How can I parse out the last set of x's before the ;0?
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Jul 5th, 2007, 01:46 PM
#2
Re: Parsing Data
Code:
Dim arrSeries() As String
Dim strSeries As String
strSeries = "xxxxx;xxxxx;xxx;xxx;xxx;xxxx;0"
arrSeries = Split(strSeries,";")
The last series of x's will be arrSeries(5)
-
Jul 5th, 2007, 06:51 PM
#3
Re: Parsing Data
Splitting on ";" will give you an array as posted by Hack. arSeries at Ubound(arrSeries) would be zero so your last batch of xxxx's would be at arrSeries(Ubound(arrSeries)-1)
-
Jul 6th, 2007, 08:22 AM
#4
Frenzied Member
Re: Parsing Data
Isn't that the same thing as arrSeries(5)?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jul 6th, 2007, 09:35 AM
#5
Addicted Member
Re: Parsing Data
Since you don't seem to be using the 0.. you can drop it off before the Split() function.
vb Code:
strSeries = Mid(strSeries, 1, Len(strSeries) - 2)
Works either way though.
- If you found my post to be helpful, please rate me.

-
Jul 6th, 2007, 10:14 AM
#6
Re: Parsing Data
 Originally Posted by SeanK
Isn't that the same thing as arrSeries(5)?
Didn't bother to count, my point of reference was the delimiter and zero, not the first character to the left. Parsing is mostly about repetitive patterns and selecting point of reference ...not just counting characters. what if there were hundreds of characters on either side?
-
Jul 6th, 2007, 10:46 AM
#7
Re: Parsing Data
As long as the delimiter is a semi-colon, it really wouldn't matter how many characters there were on either side.
-
Jul 6th, 2007, 10:58 AM
#8
Re: Parsing Data
But then he'd be counting semicolons to hardcode the index.
-
Jul 6th, 2007, 11:05 AM
#9
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
|