Created
February 9, 2017 09:14
-
-
Save zigdanis/1f22a5a7139f2bce5c8f0becff1e0806 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSString *)getNumEndingForNumber:(int)iNumber endingsArray:(NSArray *)aEndings { | |
NSString *sEnding = nil; | |
int i = 0; | |
iNumber = iNumber % 100; | |
if (iNumber >= 11 && iNumber <= 19) { | |
sEnding = aEndings[2]; | |
} else { | |
i = iNumber % 10; | |
switch (i) { | |
case 1: | |
sEnding = aEndings[0]; | |
break; | |
case 2: | |
case 3: | |
case 4: | |
sEnding = aEndings[1]; | |
break; | |
default: | |
sEnding = aEndings[2]; | |
break; | |
} | |
} | |
return sEnding; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment