Hello everyone;
Can you help me with the following problem :
I have the following list :
txtList = “1,Oranges;2,Apples;3,Lemons;4,Peers”
Everything separated by the “;” delimiter is a record and belongs to each other.
So when doing the following :
[code]Using Xojo.Core // Using the new framework
Dim txtList As Text
Dim txtRecord(-1) As Text
Dim txtSubRecord(-1) As Text
Dim strList As Text
// Assigning values to the list
txtList = “1,Oranges;2,Apples;3,Lemons;4,Peers”
// Splitting the list into records
txtRecord = txtList.Split(";") // Now txtRecord contains 4 elements (zero based)
// Get the 2nd element
MsgBox txtRecord(1) // shows “2,Apples”
// Splitting the 2nd element based on the “,” character
txtSubRecord = txtRecord(1).Split(",") // txtSubRecord is contains now 2 elements, element 0 = 2, element 1 = Apples
MsgBox "ID : " + txtSubRecord(0) + " Fruit : " + txtSubRecord(1) // Shows ID : 2 Fruit : Apples
[/code]
The split is succesfull and I get exactly what I need. However I wish to do that in one line. So on the moment I split the record with the “;” sign I want to immediatelly split the record and the subrecords.
My logic is flawed, when I overlook this code again. It is simply impossible to make my request in one pass because to get those sub-records we need to iterate through txtRecord for each record it consists.
However I decided to post it anyway, in case someone use a split example in the new framework.
Friendly greetings,
Chris