Reputation: 13
I have a string:
countries = "India,Bangladesh,Srilanka,South Africa,Australia,Canada"
I need to get an array from it:
countries = ["India","Bangladesh","Srilanka","South Africa","Australia","Canada"]
How I can do this?
Upvotes: 1
Views: 72
Reputation: 2353
Try this:
countries = "India,Bangladesh,Srilanka,South Africa,Australia,Canada".split(',')
Upvotes: 2