iOS Question Explode string to array

tariqyounis

Member
Licensed User
Longtime User
Hello,
I need help for this issue.

I have a string "computer hardware,Computer mouse,Computer,Computer hardware," and I want to have each word in an array

Thank you
 

William Lancee

Well-Known Member
Licensed User
Longtime User
B4X:
    Dim s As String = "computer hardware,Computer mouse,Computer,Computer hardware,"
    Dim words() As String = Regex.Split(" ", s.Replace(",", " "))
    For i = 0 To words.Length - 1
        Log(i & TAB & words(i))
    Next
'0    computer
'1    hardware
'2    Computer
'3    mouse
'4    Computer
'5    Computer
'6    hardware
 
Upvote 1
Top