NSString stringWithFormat
Posted
by Leo
on Stack Overflow
See other posts from Stack Overflow
or by Leo
Published on 2010-04-29T19:26:37Z
Indexed on
2010/04/29
20:07 UTC
Read the original article
Hit count: 366
Hi Guys,
I don't know what I am missing here. I am trying to concatenate strings using NSString stringWithFormat function. This is what I am doing.
NSString *category = [row objectForKey:@"category"];
NSString *logonUser = [row objectForKey:@"username"];
user.text = [NSString stringWithFormat:@"In %@ by %@", category, logonUser];
The problem here is that it always print only one variable. Say if there is "Sports" in category and "Leo" in logonUser it will print "In Sports" and skip the remaining text. It should print "In Sports by Leo".
Thanks
© Stack Overflow or respective owner