List of utility methods to do Number Format
String | formatCCNumber(String f, String s) format CC Number if (s == null || s.length() < 15) { throw new IllegalArgumentException("[" + s + "]"); String format = f; String formatted; if (s.length() == 16) { if (format == null || format.length() == 0) { format = "%.4s %.4s %.4s %.4s"; ... |
String | formatCsv(final Number number) format Csv if (number == null) { return ""; return formatCsv(number.longValue()); |
Object | formatFolioNumber(Integer folioNum, String folioMod) This method will format an input id for document identifier. String value = "00" + folioNum.toString(); return value.substring(value.length() - 3); |
String | formatFromCurrentPageIndex(int nbItemsPerPage, int totalNumberOfItems, int indexOfCurrentPage) Centralizes the formatting of a pagination context label. return formatFromFirstIndexOfItem(nbItemsPerPage, totalNumberOfItems,
(nbItemsPerPage * indexOfCurrentPage));
|
int | formatInt(String number) format Int try { return new Integer(number); } catch (Exception e) { return -1; |
String | FormatIntNoWithZero(int pNumber, int tolLen) Format Int No With Zero Integer pNo = new Integer(pNumber); String retVal = pNo.toString(); for (int i = 0; i < tolLen - pNo.toString().length(); i++) { retVal = "0" + retVal; return retVal; |
String | formatLineNumber(String lineNumber) format Line Number return (lineNumber != null) ? (lineNumber + " ") : ""; |
String | formatMs(long number) format Ms long hrs = number / HRS; number = number % HRS; long mins = number / MINS; number = number % MINS; long secs = number / SECS; return (hrs > 0 ? hrs + "hours " : "") + (mins > 0 ? mins + " minutes " : "") + (mins < 2 ? secs + " seconds" : ""); |
String | formatNationalNumber(String nationalNumber) format National Number StringBuilder formatted = new StringBuilder(nationalNumber.substring(0, 2)); formatted.append('.'); formatted.append(nationalNumber.substring(2, 4)); formatted.append('.'); formatted.append(nationalNumber.substring(4, 6)); formatted.append('-'); formatted.append(nationalNumber.substring(6, 9)); formatted.append('.'); ... |
String | formatNCPDPNumber(String origNumber, int decimalPoints) format NCPDP Number if (origNumber == null || origNumber.equals("")) { return ""; if (origNumber.endsWith("{")) { origNumber = origNumber.replace("{", "0"); } else if (origNumber.endsWith("A")) { origNumber = origNumber.replace("A", "1"); } else if (origNumber.endsWith("B")) { ... |