Split a comma separated string into swift array

If you have got a string which is separated using any delimiter like ‘,’ or space or ‘|’ or any other fixed delimiter, you can easily split it in swift by using the following function

components(separatedBy: )

Example below converts a greetings string into a swift greetings array using delimiter

let greetings = "Namaste,Hello,Hi,Good morning,:)"
let arrayGreeteings = greetings.components(separatedBy: ",")

print(arrayGreeteings)

Hope this helps!!!

A pat on the back !!

NEED A JOB? NEED TO HIRE? NEED HELP?

Join group of Software Professionals

iOS DEVELOPER’S DEN