0

I am using NSURLComponents in Swift 4 like so:

let urlComponents = NSURLComponents(string: webservice + "?PDFFile=" + PDFFile);

My String PDFFile looks like this:

Tom & Jane PDF.pdf

My question is how do I escape the ampersand in NSURLComponents?

This is what I get:

ANC%2520%26%2520SHO%2520-%2520Laundry%2520Closets%2520to%2520be%2520Checked.pdf

But this is what I need:

ANC+%26+SHO+-+Laundry+Closets+to+be+Checked.pdf
rmaddy
  • 307,833
  • 40
  • 508
  • 550
user979331
  • 9,373
  • 64
  • 206
  • 383

0 Answers0