Split an NSString to access one particular piece

后端 未结 7 1611
轮回少年
轮回少年 2020-11-27 11:59

I have a string like this: @\"10/04/2011\" and I want to save only the \"10\" in another string. How can I do that?

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 12:49

    Swift 3.0 version

    let arr = yourString.components(separatedBy: "/")
    let month = arr[0]
    

提交回复
热议问题