I have a little question

TrisectDevelopment

Active Member
Licensed User
Longtime User
I download some text from a website in my App looking like this:

B4X:
<string xmlns="http://xx-xxxxx.xxxxxxx.xxx">
2208£2141£18£1£13-04-2012 00:00:00£1£1$ 2209£2142£18£1£13-04-2012 00:00:00£1£1$ 2210£2143£29£2£11-04-2012 00:00:00£1£1$ 2211£2144£165£1£11-04-2012 00:00:00£1£1$ 2212£2144£164£1£17-04-2012 00:00:00£1£1$ 2213£2144£163£1£17-04-2012 00:00:00£1£0$ 2214£2144£166£1£11-04-2012 00:00:00£1£1$ 2215£2145£123£13£11-04-2012 00:00:00£1£1$ 2216£2146£18£1£16-04-2012 00:00:00£1£1$ 2217£2147£27£6£16-04-2012 00:00:00£1£1$ 2218£2148£27£6£16-04-2012 00:00:00£1£1$ 2219£2149£95£1£16-04-2012 00:00:00£1£1$ 2220£2150£19£1£16-04-2012 00:00:00£1£1$ 2221£2151£3£1£13-04-2012 00:00:00£1£1$ 2222£2152£3£1£12-04-2012 00:00:00£1£1$ 2224£2155£118£2£04-04-2012 00:00:00£1£1$ 2225£2156£29£2£12-04-2012 00:00:00£1£1$ 2226£2157£3£1£13-04-2012 00:00:00£1£1$
</string>

The xx-xxxxx.xxxxxxx.xxx is of cause different.
I put this string in a string variable.

I tried to search this forum for help but can't seem to find anything that can help.

I wan't to get this from the string:
B4X:
2208£2141£18£1£13-04-2012 00:00:00£1£1$ 2209£2142£18£1£13-04-2012 00:00:00£1£1$ 2210£2143£29£2£11-04-2012 00:00:00£1£1$ 2211£2144£165£1£11-04-2012 00:00:00£1£1$ 2212£2144£164£1£17-04-2012 00:00:00£1£1$ 2213£2144£163£1£17-04-2012 00:00:00£1£0$ 2214£2144£166£1£11-04-2012 00:00:00£1£1$ 2215£2145£123£13£11-04-2012 00:00:00£1£1$ 2216£2146£18£1£16-04-2012 00:00:00£1£1$ 2217£2147£27£6£16-04-2012 00:00:00£1£1$ 2218£2148£27£6£16-04-2012 00:00:00£1£1$ 2219£2149£95£1£16-04-2012 00:00:00£1£1$ 2220£2150£19£1£16-04-2012 00:00:00£1£1$ 2221£2151£3£1£13-04-2012 00:00:00£1£1$ 2222£2152£3£1£12-04-2012 00:00:00£1£1$ 2224£2155£118£2£04-04-2012 00:00:00£1£1$ 2225£2156£29£2£12-04-2012 00:00:00£1£1$ 2226£2157£3£1£13-04-2012 00:00:00£1£1$

Then I wan't to split it up in text divided by the $ characters.
The each of these lines should be divided by the £ characters. (is like this � in my browser)

Can anyone direct me in the right direction or if possible show some code that can do the trick?

I need this to get a lot of data from a website.

Later I have to save this data, maybe to SQL or file I don't know yet. But I cross that bridge when I get to it.
 

NJDude

Expert
Licensed User
Longtime User
You could use the code below to split the string:
B4X:
Dim Var As String
Dim Parts() As String
            
Var = "2208�2141�18�1�13-04-2012 00:00:00�1�1$ 2209�2142�18�1�13-04-2012 00:00:00�1�1$ 2210�2143�29�2�11-04-2012 00:00:00�1�1$ 2211�2144�165�1�11-04-2012 00:00:00�1�1$ 2212�2144�164�1�17-04-2012 00:00:00�1�1$ 2213�2144�163�1�17-04-2012 00:00:00�1�0$ 2214�2144�166�1�11-04-2012 00:00:00�1�1$ 2215�2145�123�13�11-04-2012 00:00:00�1�1$ 2216�2146�18�1�16-04-2012 00:00:00�1�1$ 2217�2147�27�6�16-04-2012 00:00:00�1�1$ 2218�2148�27�6�16-04-2012 00:00:00�1�1$ 2219�2149�95�1�16-04-2012 00:00:00�1�1$ 2220�2150�19�1�16-04-2012 00:00:00�1�1$ 2221�2151�3�1�13-04-2012 00:00:00�1�1$ 2222�2152�3�1�12-04-2012 00:00:00�1�1$ 2224�2155�118�2�04-04-2012 00:00:00�1�1$ 2225�2156�29�2�12-04-2012 00:00:00�1�1$ 2226�2157�3�1�13-04-2012 00:00:00�1�1$"
            
Parts = Regex.Split("\$", Var)
            
For I = 0 To Parts.Length - 1
            
    Msgbox(Parts(I), "Parts")
            
Next
 
Last edited:
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You might need to tweak this a little bit, but it should work:
B4X:
Dim Line As String
Dim Items() As String
Dim Matcher1 As Matcher

Line = "<string xmlns='http://xx-xxxxx.xxxxxxx.xxx'>2208�2141�18�1�13-04-2012 00:00:00�1�1$ 2209�2142�18�1�13-04-2012 00:00:00�1�1$ 2210�2143�29�2�11-04-2012 00:00:00�1�1$ 2211�2144�165�1�11-04-2012 00:00:00�1�1$ 2212�2144�164�1�17-04-2012 00:00:00�1�1$ 2213�2144�163�1�17-04-2012 00:00:00�1�0$ 2214�2144�166�1�11-04-2012 00:00:00�1�1$ 2215�2145�123�13�11-04-2012 00:00:00�1�1$ 2216�2146�18�1�16-04-2012 00:00:00�1�1$ 2217�2147�27�6�16-04-2012 00:00:00�1�1$ 2218�2148�27�6�16-04-2012 00:00:00�1�1$ 2219�2149�95�1�16-04-2012 00:00:00�1�1$ 2220�2150�19�1�16-04-2012 00:00:00�1�1$ 2221�2151�3�1�13-04-2012 00:00:00�1�1$ 2222�2152�3�1�12-04-2012 00:00:00�1�1$ 2224�2155�118�2�04-04-2012 00:00:00�1�1$ 2225�2156�29�2�12-04-2012 00:00:00�1�1$ 2226�2157�3�1�13-04-2012 00:00:00�1�1$</string>"

Matcher1 = Regex.Matcher("'>.*</", Line)

Do While Matcher1.Find

   Line = Matcher1.Match
   Items = Regex.Split("\$", Line)

   Msgbox(Line, "Line")
         
Loop

For I = 0 To Items.Length - 1

    Msgbox(Items(I), "Result")
            
Next
 
Last edited:
Upvote 0
Top