Return the english suffix for a given ordinal value @param iValue the ordinal value @return ordinal suffix (st, nd, etc.)
(final int iValue)
| 285 | * @return ordinal suffix (st, nd, etc.) |
| 286 | */ |
| 287 | public static String ordinal(final int iValue) |
| 288 | { |
| 289 | String suffix = "th"; |
| 290 | |
| 291 | if ((iValue < 4) || (iValue > 20)) |
| 292 | { |
| 293 | switch (iValue % 10) |
| 294 | { |
| 295 | case 1 -> suffix = "st"; |
| 296 | case 2 -> suffix = "nd"; |
| 297 | case 3 -> suffix = "rd"; |
| 298 | default -> { |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | return Integer.toString(iValue) + suffix; |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Turn a 'separator' separated string into a ArrayList of strings, each |
no test coverage detected