Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSString *)afterNumberTextWithNumber:(NSNumber *)number
- oneText:(NSString *)text1
- fewText:(NSString *)text2
- lotText:(NSString *)text3
- {
- int withoutHundred = number.intValue % 100;
- int lastDigit = withoutHundred % 10;
- NSString *text = text3;
- NSArray *exceptNumbers = @[@11, @12, @13, @14];
- if (lastDigit == 1 && ![exceptNumbers containsObject:number]) {
- text = text1;
- }
- if (lastDigit > 1 && lastDigit < 5 && ![exceptNumbers containsObject:number]) {
- text = text2;
- }
- return [NSString stringWithFormat:@"%@ %@", number, text];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement