0

How can I find out specific character from URL String variable using Swift 3? A URL is visible photo, i want to get the value out of the URL user_lati,user_long,destination_lat,destinaton_long

i want to get the value out of the URLlink(image is given) user_lati,user_long,destination_lat,destinaton_long and save it.

Can any one give me the solution for this?

Ankit Kumawat
  • 75
  • 1
  • 1
  • 6

1 Answers1

0

I have given a couple of examples below. You should really check the documentation for String, URL and Collections

let urlString = "https://www.example.com/search?q=test&user=john"
let url = URL(string: urlString)!

print(url.query) // q=test&user=john
print(urlString.index(of: "?")?.encodedOffset) // 30 - index of ?
print(url.absoluteString.index(of: "?")?.encodedOffset) // same as above
Scriptable
  • 19,402
  • 5
  • 56
  • 72