Class Formatter

java.lang.Object
de.redstoneworld.redutilities.misc.Formatter

public class Formatter extends Object
  • Constructor Details

    • Formatter

      public Formatter()
  • Method Details

    • getTimeString

      public static String getTimeString(Date date, String format)
      This method returns the date object in the desired formatting.
      Parameters:
      date - (Date) the target date object
      format - (String) the format definition
      Returns:
      (String) the formatted time string
    • getTimeString

      public static String getTimeString(long timestamp, String format)
      This method returns the timestamp in the desired formatting.
      Parameters:
      timestamp - (long) the target timestamp
      format - (String) the format definition
      Returns:
      (String) the formatted time string
    • getRationalNumberValue

      public static double getRationalNumberValue(String cmdInput)
      This method reforms the rational number spelling and convert it to a double number. Flexible inputs are allowed, which improves the usability.
      Parameters:
      cmdInput - the rational number with one of all supported spellings
      Returns:
      (double) the formatted rational number (decimal value)
    • getRationalNumberMsg

      public static String getRationalNumberMsg(float floatValue)
      This method outputs the rational number as a string. The decimal separator remains at the point (".") .
      Parameters:
      floatValue - the rational number
      Returns:
      (String) the formatted string.
    • getRationalNumberMsg

      public static String getRationalNumberMsg(Double doubleValue)
      This method outputs the rational number as a string. The decimal separator remains at the point (".") .
      Parameters:
      doubleValue - the rational number
      Returns:
      (String) the formatted string.
    • getRationalNumberMsg

      public static String getRationalNumberMsg(float floatValue, String decimalSeparator)
      This method outputs the rational number as a string. The decimal separator can also be specified.
      Parameters:
      floatValue - the rational number
      decimalSeparator - the decimal separator
      Returns:
      (String) the formatted string.
    • getRationalNumberMsg

      public static String getRationalNumberMsg(Double doubleValue, String decimalSeparator)
      This method outputs the rational number as a string. The decimal separator can also be specified.
      Parameters:
      doubleValue - the rational number
      decimalSeparator - the decimal separator
      Returns:
      (String) the formatted string.