This question already has an answer here:
- How to encode a URL in Swift 13 answers
I'd like to use google to search for a specific string like "Ouhh, let's call this hello world! (^_^)"
.
I found out that I can use this URL https://www.google.com/search?&q=search+for+this+string to search for "search for this string"
.
How can I validate any string (that includes special characters like '/
', '\
', '=
', ...) to get a matching search URL?
string mySearchQuery = "Ouhh, let's call this hello world! (^_^)";
UIApplication.shared.open(URL(string: "https://www.google.com/search?&q=" + mySearchQuery)!, options: [:], completionHandler: nil); // not working because of the special characters.
Aucun commentaire:
Enregistrer un commentaire