0

In swift,I can use subSting() method to get a subString like this:

let sessionId = "this is a test"

let index = sessionId.index(sessionId.startIndex, offsetBy: 2)

let prefix = sessionId.substring(to: index)

But,today I found the method'availability is iOS 10 and later.How to handle this problem for you guys?

Availability iOS (10.0 and later), macOS (10.12 and later), tvOS (10.0 and later), watchOS (3.0 and later)

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
chokshen
  • 101
  • 5
  • 1
    I Suggest you to put your effort in searching before shooting the question https://stackoverflow.com/a/28182819/2700586 – Mani Jul 21 '17 at 05:56
  • Thanks ,bro.It's my first question in stackoverflow ,and I am acually a freshman.Your advice help me a lot. – chokshen Jul 21 '17 at 06:09
  • 1
    Possible duplicate of [Swift: How to get substring from start to last index of character](https://stackoverflow.com/questions/28182441/swift-how-to-get-substring-from-start-to-last-index-of-character) – Anh Pham Jul 21 '17 at 06:11

0 Answers0