Here you can find the source of formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken, final String informalHourName)
Parameter | Description |
---|---|
minuteRoundedName | e.g., '5 past' |
minuteRoundingToken | - e.g. - 'nearly' |
informalHourName | - e.g.: 'midnight', 'noon', one am |
private static String formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken, final String informalHourName)
//package com.java2s; public class Main { /**//w ww .j a v a2 s.c om * Generate nicely formatted conversational / informal time string, * intelligently dealing with whitespace. * * @param minuteRoundedName * e.g., '5 past' * @param minuteRoundingToken * - e.g. - 'nearly' * @param informalHourName * - e.g.: 'midnight', 'noon', one am * @return informalTime - nicely formatted informal time string */ private static String formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken, final String informalHourName) { String informalTime; if ("".equals(minuteRoundedName)) { informalTime = minuteRoundingToken + informalHourName; } else { informalTime = minuteRoundingToken + minuteRoundedName + " " + informalHourName; } return informalTime; } }