componentsSeparatedByString() Error in Swift 3

后端 未结 1 968
孤城傲影
孤城傲影 2021-02-11 15:46
var numbers = \"Hello,Goodbye,Hi,Bye\"
var numbersArr = numbers.componentsSeparatedByString(\",\")

//[\"Hello\".\"Goodbye\",\"Hi\",\"Bye\"]

相关标签:
1条回答
  • 2021-02-11 16:51

    It looks like there is a components(separatedBy:) on String:

    import Foundation
    
    let words = "apple binary cat delta echo".components(separatedBy: " ")
    print(words)
    

    IBM Playground link: http://swiftlang.ng.bluemix.net/#/repl/57868332b4e4e9971bf9f4e8

    0 讨论(0)
提交回复
热议问题