Java String Pad Right rightPadString(String str, char pad, int length)

Here you can find the source of rightPadString(String str, char pad, int length)

Description

right Pad String

License

Apache License

Declaration

public static String rightPadString(String str, char pad, int length) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String rightPadString(String str, char pad, int length) {
        if (str.length() >= length)
            return str;
        StringBuffer sb = new StringBuffer(str);
        while (sb.length() < length)
            sb.append(pad);/*from w w w . ja v  a  2  s .  c o  m*/
        return sb.toString();
    }
}

Related

  1. rightPaddedString(String string, int length, char paddingChar)
  2. rightPadding(int id, int value)
  3. rightPaddWithSpace(String pString_, int stellen)
  4. rightPadInt(int number, int width)
  5. rightPadOrTruncate(String str, int resultSz)
  6. rightPadString(StringBuilder builder, char padding, int multipleOf)
  7. tailPad(String target, String padChar, int length)