Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void daySuffixTester() {
- myWindow.clearOut();
- int i;
- for (i = 1; i <= 31; i++) {
- myWindow.writeOutLine(daySuffix(i + ""));
- }
- }
- private String daySuffix(String t) {
- String day = "";
- if (isNumeric(t)) {
- int s = (int) Math.round(Double.parseDouble(t));
- if (s >= 1 && s <= 31) {
- if (s == 1 || s == 21 || s == 31)
- day = s + "st";
- else if (s == 2 || s == 22)
- day = s + "nd";
- else if (s == 3 || s == 23)
- day = s + "rd";
- else if (s >= 4 && s <= 20 || s >= 24 && s <= 30)
- day = s + "th";
- //return day;
- } else day = "null";
- }
- else
- day = "null";
- return day;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement