I'm one of the thousands of procedural programmers lured by the promise of the iPhone platform into the maze of twisty little passages, all the same, that is object oriented Objective-C on Xcode. Like many others, I'm attempting this without a net, and in the absence of a resident necromancer, staff daemonologist, or even a consulting exorcist.
Frankly, it's bewildering. Here's the conundrum du jour:
This displays http://www.domain.tld.
...but alas, I need to build a querystring for my url. Consulting the entrails of a sacrificed chicken (and the Xcode docs and a couple of books on Objective C and Xcode), it appeared that the answer was to use stringWithFormat. However, the following code sample indicates that was naive in the extreme:
This (of course!) displays two Chinese characters and a square box followed by ?query=4.000.
Being a bear of very little brain, I also tried @"%s?query%.3f" as the format string with similarly dismal results.
Can anyone point me at some documentation on how to concatenate strings in a useful way in the iPhone environment?
Frankly, it's bewildering. Here's the conundrum du jour:
Code:
NSString *myString = @"http://www.domain.tld";
myLabel.text=myString;
This displays http://www.domain.tld.
...but alas, I need to build a querystring for my url. Consulting the entrails of a sacrificed chicken (and the Xcode docs and a couple of books on Objective C and Xcode), it appeared that the answer was to use stringWithFormat. However, the following code sample indicates that was naive in the extreme:
Code:
NSString *myString = @"http://www.domain.tld";
float myValue = 4;
NSString *result = [NSString stringWithFormat:@"%S?query=%.3f",myString,myValue];
myLabel.text=result;
This (of course!) displays two Chinese characters and a square box followed by ?query=4.000.
Being a bear of very little brain, I also tried @"%s?query%.3f" as the format string with similarly dismal results.
Can anyone point me at some documentation on how to concatenate strings in a useful way in the iPhone environment?