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
  • 314,917
  • 42
  • 532
  • 579
user979331
  • 11,039
  • 73
  • 223
  • 418

0 Answers0