Android Question Select numbers from a string

Urishev

Member
Licensed User
Longtime User
How to select numbers from a string Str = "1,2,3"
to get
a=1
b=2
c=3
Dim a, b, c As Int
 

DonManfred

Expert
Licensed User
Longtime User
Use Regex to split them
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Please tell me how to use Regex in this case.
Give @DonManfred a break. He is probably still celebrating Germany's World Cup 2018 victory from last night. Here it is
B4X:
Dim Str As String= "1,2,3"
    Dim strArray() As String=Regex.Split(",",Str)
    Dim a As Int= strArray(0)  :Log(a) 'displays 1
    Dim b As Int= strArray(1)  :Log(b) 'displays 2
    Dim c As Int= strArray(2)  :Log(c) 'displays 3
 
Upvote 0
Top