uk.co.automatictester.lightning.utils.IntToOrdConverter Maven / Gradle / Ivy
package uk.co.automatictester.lightning.utils;
public class IntToOrdConverter {
public String convert(int i) {
String[] sufixes = new String[]{"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"};
if ((i % 100) == 11 || (i % 100) == 12 || (i % 100) == 13) {
return i + "th";
} else {
return i + sufixes[i % 10];
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy