MCPcopy Create free account
hub / github.com/PCGen/pcgen / ordinal

Method ordinal

code/src/java/pcgen/core/utils/CoreUtility.java:287–304  ·  view source on GitHub ↗

Return the english suffix for a given ordinal value @param iValue the ordinal value @return ordinal suffix (st, nd, etc.)

(final int iValue)

Source from the content-addressed store, hash-verified

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

Callers 11

returnNameMethod · 0.95
setupDisplayMethod · 0.80
setOptionsPropertiesMethod · 0.80
evaluateMethod · 0.80
appendAutoSortLinesMethod · 0.80
getAcpOutputMethod · 0.80
checkLtEqMethod · 0.80

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected