var numbers = "Hello,Goodbye,Hi,Bye"
var numbersArr = numbers.componentsSeparatedByString(",")
//["Hello"."Goodbye","Hi","Bye"]
Above is a basic representation of what I'm trying to do. I'm trying to use componentsSeparatedByString()
to split a string with commas into an array, where each of the components of the array are between each of the commas from the original strings.
I am using IBM Swift Sandbox (Sorry, I'm on windows :) ), and in Swift 3.0, I am getting this error message:
value of type 'String' has no member 'componentsSeparatedByString'
I know Swift 3 is rather new, and is that is why I couldn't find ANY other references for this error.
It looks like there is a
components(separatedBy:)
onString
:IBM Playground link: http://swiftlang.ng.bluemix.net/#/repl/57868332b4e4e9971bf9f4e8