Reputation: 1625
this seems like it is probably dead simple to somebody but I'm stuck.
I have this little app that picks a random thing from an array of things and then displays it to the user in the form of a question.
NSLog(@"How about %@?", theThing);
// How About...
self.theThingLabel.text = theThing;
//How do I add a question mark to the end of that string
in the code above the NSLog string works just like I want the label to work. I take care of the "how about" part as a string above the displayed result, but I can't figure out how to add that question mark .. something like theThing+"?"
I tried a bunch of stuff but instead of getting lucky I got warned by xcode over and over.
Upvotes: 0
Views: 72
Reputation: 5667
NSString *what= @"What";
NSString *finalString = [NSString stringWithFormat:@"How about %@ ..?", what];
NSLog(@"%@", finalString);
Hope that helps
Upvotes: 0
Reputation: 4244
theThing = [NSString stringWithFormat:@"How about %@?",theThing];
NSLog(@"%@", theThing);
then
self.theThingLabel.text = theThing;
Hope it helps..
Upvotes: 0
Reputation: 2523
Use this :
self.theThingLabel.text = [NSString stringWithFormat:@"How about %@ ?", theThing];
Upvotes: 0
Reputation: 178
Try this
self.theThingLabel.text = [theThing stringByAppendingString:@" ?"];
Upvotes: 1
Reputation: 2266
self.theThingLabel.text = [NSString stringWithFormat:@"How about %@?",theThing];
This is very easy
Upvotes: 0