I am retrieving ordinal numbers using below code:
public static String ordinal(int i) {
String[] sufixes = new String[] { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
switch (i % 100) {
case 11:
case 12:
case 13:
return i + "th";
default:
return i + sufixes[i % 10];
}
}
Output : 1st, 2nd, 3rd...
How can I get string like first, second, third from these ordinal numbers in java, Android.