Package snap.util

Class FormatUtils

java.lang.Object
snap.util.FormatUtils

public class FormatUtils extends Object
Utilities for formatting numbers and dates.
  • Constructor Details

    • FormatUtils

      public FormatUtils()
  • Method Details

    • formatNum

      public static String formatNum(double aValue)
      Formats a number to a reasonable precision.
    • formatNum

      public static String formatNum(Number aVal)
      Formats a number to a reasonable precision.
    • formatNum

      public static String formatNum(String aPattern, Object aNum)
      Formats a number with given Decimal format pattern.
    • getDecimalFormat

      public static DecimalFormat getDecimalFormat(String aPattern)
      Returns a decimal format for given pattern.
    • getDateFormat

      public static DateFormat getDateFormat(String aPattern)
      Returns a date format for given pattern.
    • formatDate

      public static String formatDate(Date aDate)
      Formats a Date to a standard pattern: .
    • formatDate

      public static String formatDate(Date aDate, String aPattern)
      Formats a Date to a reasonable precision.
    • getDateFormat

      public static SimpleDateFormat getDateFormat()
      Returns a SimpleDateFormat.
    • getPatternForFractionDigits

      public static String getPatternForFractionDigits(int aFractionDigitCount)
      Returns a pattern for given number of fraction digits.