我正在使用以下代码检索序数:
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];
}
}
输出:第一,第二,第三...
如何从 java、Android 中的这些序数中获取第一个、第二个、第三个字符串。