Class FixedLengthPadding

java.lang.Object
javatapas.string.FixedLengthPadding

public class FixedLengthPadding
extends Object
Return a String padded to a fixed length using a specified padding character.

Published at https://www.javatapas.com/string/Java-Fixed-Length-Padding.html

Javadoc at https://www.javatapas.com/docs/javatapas/string/FixedLengthPadding.html
Version:
2021-05-18
Author:
Kodiak Brown
  • Constructor Details

    • FixedLengthPadding

      public FixedLengthPadding()
  • Method Details

    • fixedLengthPadding

      public static String fixedLengthPadding​(String inStr, int fixedInt)
      This calls the fixedLength method with the default settings of blank spaces as the pad character, and remaining text is right justified
      Parameters:
      inStr - The input String to be padded to a fixed length.
      fixedInt - The length of the output String.
    • fixedLengthPadding

      public static String fixedLengthPadding​(String inStr, int fixedInt, char pad, boolean rightLeft)
      Parameters:
      inStr - The input String to be padded to a fixed length.
      fixedInt - The length of the output String.
      pad - The character to pad the String with.
      rightLeft - If true the output String will be right justified, otherwise it will be left justified.