Java String Pad Right rightPad(String targetStr, char appendChar, int length)

Here you can find the source of rightPad(String targetStr, char appendChar, int length)

Description

right Pad

License

Apache License

Declaration

public static String rightPad(String targetStr, char appendChar, int length) 

Method Source Code

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

public class Main {

    public static String rightPad(String targetStr, char appendChar, int length) {
        if (targetStr == null) {
            return null;
        }//w w  w . ja  v a2  s  . c o m
        int len = targetStr.length();
        while (len++ < length) {
            targetStr += appendChar;
        }
        return targetStr;
    }
}

Related

  1. rightPad(String str, int width)
  2. rightPad(String str, int width, char padding)
  3. rightPad(String str, String pad, int len)
  4. rightPad(String string, int length)
  5. rightPad(String strInput, int intLength)
  6. rightPad(String toPad, int totalLength)
  7. rightPad(String value, int length)
  8. rightPad(String value, int makeLength, char paddingCharacter)
  9. rightPad(String value, int tamanho, String pad)