I'm reading someone elses code and they are using %@-1 to format an integer. I can't find anything on Google since it ignores symbols. Anyone else had more experience at string formatting than me?
[NSString stringWithFormat:@"%@-1", subnumber]
Thanks!
According to the specification:
We're using a conversion of the first type, since there's no dollar sign in here. Note the words in sequence at the top of the above list. The
@is a conversion specifier character (as mentioned here), which indicates that we should access the value passed in as anNSObjectand read itsdescriptionproperty. Since we've already reached the last bullet point, the format code actually ends after the@symbol, and as @Kevin Ballard pointed out, the-1is parsed as literal text.