Swift version of componentsSeparatedByString

后端 未结 4 693
攒了一身酷
攒了一身酷 2020-11-29 08:04

I know its noob question, i really search around before ask. But there is not exact answer of what i want to know. How we split string into the array without using Objectiv

4条回答
  •  悲&欢浪女
    2020-11-29 08:40

    In Swift 3.0 Use components(separatedBy:) on String than componentsSeparatedByString.

    Sharing code sample

    let tempString = "1.Wash your hands\n2.Check you phone\n3.Click home button".components(separatedBy: "\n")
    print(tempString)
    

提交回复
热议问题