'init(start:end:)' is deprecated: it will be removed in Swift 3. Use the '..<' operator

后端 未结 6 575
予麋鹿
予麋鹿 2020-12-04 20:54

I\'m using the following code:

var continousDigitsRange:Range = Range(start: 0, end: 0)

Since update to Xcode 7.3 (Sw

6条回答
  •  失恋的感觉
    2020-12-04 21:43

    to show bmichotte's answer in full...

    let theString = "Hello, how are you today my friend"
        let start = 3
        let end = 15
        let range = theString.startIndex.advancedBy(start) ..< theString.startIndex.advancedBy(end)
        let p = theString.substringWithRange(range)
        print("this is the middle bit>\(p)<")
    

    this produces this is the middle bit>lo, how are <

提交回复
热议问题