I have this string here:
let toEscape = "http://localhost:3000/api/Tests/update?where={ \"name\": \(updateText) }"
This string would normally be fine, except that the API software (Strongloop) I am connecting to doesn't seem to like the backslashes at \"name\". How do I escape the entire string so that I don't have to put backslashes before the quotes? In C# you can use an @ symbol at the beginning of a string, and supposedly you can do the same in Objective-C, but I haven't been able to do that in Swift, at least not so far.
A possible solution is to create an NSURL with NSURL(scheme:host:path:) and call the absoluteString() method
let escapedString = NSURL(scheme: "http", host: "localhost:3000", path: "/api/Tests/update?where={ \"name\": \(updateText) }")?.absoluteString
Edit:
or still easier
let escapedString = toEscape.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)