Hi, this question has probably been asked hundreds of times but I didn’t find an easy solution that works for me.
Problem:
I have the string: “Bob Sample, 41, Harlem Street”
I would like to split the strings at the location of commas. Then I want to assign separate variables: name=“Bob Sample”; age=“41”; street=“Harlem Street”
How can I do this?
Thanks for your time.
3 Likes
Hi @Jizh
You can do something like
StringArray = String.split(","c)
This will give you an array and you can access elements like
Name=StringArray(0) , Age= StringArray(1), Street=stringArray(2)
Where Name, Age and Street would be your local variables
Thanks,
Prankur
14 Likes
Thanks a lot, what does the c stand for in String.split(","c)?
3 Likes
It stands for single character
4 Likes
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.