Package org.drip.service.common
Class FormatUtil
java.lang.Object
org.drip.service.common.FormatUtil
public class FormatUtil
extends java.lang.Object
FormatUtil implements formatting utility functions. Currently it just exports functions to pad and
format. It implements the following Functions:
- Pre-pad a single digit integer with zeros
- Format the double input by multiplying, and then adding left and right adjustments
- Format the double input by multiplying, and then adding left and right adjustments with leading Space
- Author:
- Lakshmi Krishnamurthy
-
Constructor Summary
Constructors Constructor Description FormatUtil() -
Method Summary
Modifier and Type Method Description static java.lang.StringFormatDouble(double doubleValue, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier)Format the double input by multiplying, and then adding left and right adjustmentsstatic java.lang.StringFormatDouble(double doubleValue, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, boolean leadingSpaceForPositive)Format the double input by multiplying, and then adding left and right adjustmentsstatic java.lang.StringFormatRd(double[] rdArray, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, java.lang.String delimiter)Format the Rd Array into a Delimited Stringstatic java.lang.StringFormatRd(double[] rdArray, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, java.lang.String delimiter, boolean leadingSpaceForPositive)Format the Rd Array into a Delimited Stringstatic java.lang.StringPrePad(int i)Pre-pad a single digit integer with zerosMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FormatUtil
public FormatUtil()
-
-
Method Details
-
PrePad
public static final java.lang.String PrePad(int i)Pre-pad a single digit integer with zeros- Parameters:
i- Integer representing the input- Returns:
- String representing the padded output
-
FormatDouble
public static final java.lang.String FormatDouble(double doubleValue, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, boolean leadingSpaceForPositive)Format the double input by multiplying, and then adding left and right adjustments- Parameters:
doubleValue- Double representing the inputleftJustificationZeroes- Integer representing the number of left justifying zerosrightJustificationZeroes- Integer representing the number of right justifying zerosmultiplier- Double representing the multiplierleadingSpaceForPositive- TRUE - A Leading Space will be emitted for Adjusted Positive Numbers. For Adjusted Negatives this will be the '-' sign.- Returns:
- String representing the formatted input
-
FormatRd
public static final java.lang.String FormatRd(double[] rdArray, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, java.lang.String delimiter, boolean leadingSpaceForPositive)Format the Rd Array into a Delimited String- Parameters:
rdArray- Rd ArrayleftJustificationZeroes- Integer representing the number of left justifying zerosrightJustificationZeroes- Integer representing the number of right justifying zerosmultiplier- Double representing the multiplierleadingSpaceForPositive- TRUE - A Leading Space will be emitted for Adjusted Positive Numbers. For Adjusted Negatives this will be the '-' sign.- Returns:
- Rd Array into a Delimited String
-
FormatDouble
public static final java.lang.String FormatDouble(double doubleValue, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier)Format the double input by multiplying, and then adding left and right adjustments- Parameters:
doubleValue- Double representing the inputleftJustificationZeroes- Integer representing the number of left justifying zerosrightJustificationZeroes- Integer representing the number of right justifying zerosmultiplier- Double representing the multiplier- Returns:
- String representing the formatted input
-
FormatRd
public static final java.lang.String FormatRd(double[] rdArray, int leftJustificationZeroes, int rightJustificationZeroes, double multiplier, java.lang.String delimiter)Format the Rd Array into a Delimited String- Parameters:
rdArray- Rd ArrayleftJustificationZeroes- Integer representing the number of left justifying zerosrightJustificationZeroes- Integer representing the number of right justifying zerosmultiplier- Double representing the multiplier- Returns:
- Rd Array into a Delimited String
-