/** * Pad the given string with spaces on the left up to the given length. * * @param s String to pad * @param desiredLength ending length * @return padded String */ public static String padLeft(String s, int desiredLength) { return padLeft(s, desiredLength, " "); }
/** * Pad the given string with spaces on the left up to the given length. * * @param s String to pad * @param desiredLength ending length * @return padded String */ public static String padLeft(String s, int desiredLength) { return padLeft(s, desiredLength, " "); }
/** * Pad the given string with spaces on the left up to the given length. * * @param s String to pad * @param desiredLength ending length * @return padded String */ public static String padLeft(String s, int desiredLength) { return padLeft(s, desiredLength, " "); }
/** * Left pad the given value with zeros up to the number of digits * * @param value The value. * @param numDigits number of digits * @return The String represenation of the value, padded with * leading "0"-s if value < 10E(numDigits-1) */ public static String padZero(int value, int numDigits) { return padLeft(String.valueOf(value), numDigits, "0"); }
/** * Left pad the given value with zeros up to the number of digits * * @param value The value. * @param numDigits number of digits * @return The String represenation of the value, padded with * leading "0"-s if value < 10E(numDigits-1) */ public static String padZero(int value, int numDigits) { return padLeft(String.valueOf(value), numDigits, "0"); }
/** * Left pad the given value with zeros up to the number of digits * * @param value The value. * @param numDigits number of digits * @return The String represenation of the value, padded with * leading "0"-s if value < 10E(numDigits-1) */ public static String padZero(int value, int numDigits) { return padLeft(String.valueOf(value), numDigits, "0"); }