I have the following simple code written in Swift 3:
let str = "Hello, playground"
let index = str.index(of: ",")!
let newStr = str.substring(to: index)
From Xcode 9 beta 5, I get the following warning:
‘
substring(to:)
‘ is deprecated: Please useString
slicing subscript with a ‘partial range from’ operator.
How can this slicing subscript with partial range from be used in Swift 4?