I have an URL that looks like myapp://jhb/test/deeplink/url?id=4567
.
I want to delete every thing after the ?
char. At the end the URL should look like myapp://jhb/test/deeplink/url
. how. can I achieve that? convert the url to a string? Regex?
Use URLComponents
to separate the different URL parts, manipulate them and then extract the new url:
var components = URLComponents(string: "myapp://jhb/test/deeplink/url?id=4567")!
components.query = nil
print(components.url!)
myapp://jhb/test/deeplink/url
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With