Separate all items from a string

2

I'm trying to make a save/load system, I'm stuck in the part of loading game cards, which are numbered for example: 1 , 2 , < strong> 3 .

The string contains the card numbers among other information:

Nome|1,2,3,4,5,6,7,8,9|59000|50%

nome   cartas          money   reputação

My code for load :

Dim Nome As String = values(0)
Dim Cartas As String = values(1)
Dim Dinheiro As String = values(2)
Dim Reputacao As String = values(3)
MsgBox(Nome)
MsgBox(Cartas)
MsgBox(Dinheiro)
MsgBox(Reputacao)
Dim cards() As String = Cartas.Split(","c)
'MsgBox(cards)
Dim word As String
Dim b As Integer
For Each word In cards
    b = b +1
    MsgBox(word)
Next
Dim nCartas = b

I have the number of cards, how do I get X amount of items from string Cards ?, for example: nCartas is 10 , I want to get 10 strings from Cards. / p>     

asked by anonymous 29.09.2017 / 19:36

1 answer

2
Dim bar() As String
Dim foo() As String
Dim i As Byte

bar = Split("Nome|1,2,3,4,5,6,7,8,9|59000|50%", "|")

foo = Split(bar(1), ",")

For i = LBound(foo) To UBound(foo)
    Debug.Print foo(i)
Next i
    
29.09.2017 / 22:01