re: [Swift CODE] URLify VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Uhhh... string = string.replace(“ “, “%20”) Or if you wanna go all in: from urllib.parse import quote string = quote(string) (Snippet...
 

Yeah in Swift 5 the syntax is pretty similar
string.replaceOccurrences(of: “ “, with: “%20”)

In everyday practice, I def use that method.

Typically in interviews, interviewers want to see whether the interviewee understands/can derive the algorithm which makes that method work (hence, all the code 😬🙃)

code of conduct - report abuse