-2

I`m newbie in Swift and I have simple code, that cut string from the end to special characters "$2F" and returned cutted off string:

    let index2 = favUrlString.range(of: "%2F", options: .backwards)?.lowerBound
    favUrlString = index2.map(favUrlString.substring(to:))!

How I have to update this code to Swift 5?

1 Answers1

-1

Use String Slicing instead of Substring. like below

let yourString = "dummy string"
yourString[5..<yourString.count] // string
Jakir Hossain
  • 3,830
  • 1
  • 15
  • 29
  • 3
    Do not post comments asking for votes. And this question should not have been answered. There are many duplicates. – rmaddy Nov 07 '19 at 06:30