Android Question Explode comma seperated string into a list

tufanv

Expert
Licensed User
Longtime User
Hello,

What is the best way to create a list from a string with values seperated by comma? If the lengths was always same I could use substring2. I can still use substring2 but it won't be a good code. Is there a better way to explode this string into a list ?
For example
s= "USD,TR,MOON"
I want to add all these words into a list

Thanks
 

Mahares

Expert
Licensed User
Longtime User
I want to add all these words into a list
CSVParser class:
 
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
here is an example :)

B4X:
Dim components() As String
components = Regex.Split(",","abc,def,,ghi") 'returns: "abc", "def", "", "ghi"

components(0)="abc"
components(1)="def"
components(2)=""
components(3)="ghi"
 
Upvote 0
Top