Skip to content

Instantly share code, notes, and snippets.

View uhhuhyeah's full-sized avatar

David A McClain uhhuhyeah

View GitHub Profile
- (NSString *)ordinalize:(NSInteger)number{
if (number >= 11 && number <= 13)
return [NSString stringWithFormat:@"%dth",number];
switch (number % 10) {
case 1:
return [NSString stringWithFormat:@"%dst",number];
case 2:
return [NSString stringWithFormat:@"%dnd",number];
case 3:
return [NSString stringWithFormat:@"%drd",number];