Class Formatter
java.lang.Object
de.redstoneworld.redutilities.misc.Formatter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetRationalNumberMsg(float floatValue) This method outputs the rational number as a string.static StringgetRationalNumberMsg(float floatValue, String decimalSeparator) This method outputs the rational number as a string.static StringgetRationalNumberMsg(Double doubleValue) This method outputs the rational number as a string.static StringgetRationalNumberMsg(Double doubleValue, String decimalSeparator) This method outputs the rational number as a string.static doublegetRationalNumberValue(String cmdInput) This method reforms the rational number spelling and convert it to a double number.static StringgetTimeString(long timestamp, String format) This method returns the timestamp in the desired formatting.static StringgetTimeString(Date date, String format) This method returns the date object in the desired formatting.
-
Constructor Details
-
Formatter
public Formatter()
-
-
Method Details
-
getTimeString
This method returns the date object in the desired formatting.- Parameters:
date- (Date) the target date objectformat- (String) the format definition- Returns:
- (String) the formatted time string
-
getTimeString
This method returns the timestamp in the desired formatting.- Parameters:
timestamp- (long) the target timestampformat- (String) the format definition- Returns:
- (String) the formatted time string
-
getRationalNumberValue
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
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
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
This method outputs the rational number as a string. The decimal separator can also be specified.- Parameters:
floatValue- the rational numberdecimalSeparator- the decimal separator- Returns:
- (String) the formatted string.
-
getRationalNumberMsg
This method outputs the rational number as a string. The decimal separator can also be specified.- Parameters:
doubleValue- the rational numberdecimalSeparator- the decimal separator- Returns:
- (String) the formatted string.
-