cocoa - Formatting URL parameters in an NSURL object -
I want to pass the parameter in an NSURL. For example, I have
NSURL * url = [NSURL URLWithString: @ "http://demo.digi-corp.com:82/Nilesh/betBuddy/api/getEventsXML.php? Sp_id = 2 "]; Where sp_ID might be 1, 2, 3, 4, etc. how can I do this? Please help me
You can use the format [NSString stringWithFormat: @ ""] URL string example,
NSURL * URL = [NSURL URLWithString: [NSString stringWithFormat: @ "http://e.com/?var=%d", 2]]; If you are looking for documents for the string format specifier, then you can find exactly the characters to use for each type of replacement (integer, double, object, etc.).
Comments
Post a Comment