Package com.booksaw.betterTeams.util
Class MoneyUtils
java.lang.Object
com.booksaw.betterTeams.util.MoneyUtils
Utility methods revolving around formatting money
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
getFormattedDouble
(double amount) Get a formatted double using the default formatting in the configstatic String
getFormattedDouble
(double amount, String doubleFormat, boolean shortFormatting) Get a formatted string from a monetary amountstatic String
getFormattedShortDouble
(double amount) Get the short formatted version of the amount, i.e. 10.0Kstatic boolean
-
Constructor Details
-
MoneyUtils
public MoneyUtils()
-
-
Method Details
-
useShortFormatting
public static boolean useShortFormatting()- Returns:
- If short money is enabled in the config
-
getDecimalPlaceFormattingString
- Returns:
- The double formatted string, with the number of decimal places defined in the config
-
getFormattedDouble
Get a formatted double using the default formatting in the config- Parameters:
amount
- The value of the money to format- Returns:
- the formatted String
-
getFormattedDouble
public static String getFormattedDouble(double amount, String doubleFormat, boolean shortFormatting) Get a formatted string from a monetary amount- Parameters:
amount
- the amount of moneydoubleFormat
- the double format i.e. 0.00, used if shortFormatting is falseshortFormatting
- if true will truncate the value, such as 12.0k- Returns:
- a formatted string of the amount
-
getFormattedShortDouble
Get the short formatted version of the amount, i.e. 10.0K- Parameters:
amount
- The amount to formatted- Returns:
- The created formatted string
-