Possible duplicate:
NSNumberFormatter and & lsquo; th & rsquo; & Lsquo; st & rsquo; & Lsquo; th & rsquo; & Lsquo; th & rsquo; (serial number) endings
Hello,
I am creating an application that downloads rows of players and displays them. So say, for example, that you are the third of all players, I inserted a condition that displays it as 3rd, not 3rd, and I did the same for 2nd and 1st. When you fall into higher ranks, such as the 2883rd, it displays the 2883th (for obvious reasons)
My question is how can I reformat it to XXX1st, XXX2nd, XXX3rd, etc.
To show what I mean, here is how I format my number to add βrdβ if it is 3
if ([[container stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@"3"])
{
NSString*badge = [NSString stringWithFormat:@"%@rd",[container stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
NSString*scoreText = [NSString stringWithFormat:@"ROC Server Rank: %@rd",[container stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
profile.badgeValue = badge;
rank.text = scoreText;
}
2000 ( 2000 ) - ?