Java String Pad Left leftPad(String str, String character, int size)

Here you can find the source of leftPad(String str, String character, int size)

Description

left Pad

License

Apache License

Declaration

public static String leftPad(String str, String character, int size) 

Method Source Code

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

public class Main {
    public static String leftPad(String str, String character, int size) {
        if (str != null) {
            int delta = size - str.length();
            for (int i = 0; i < delta; i++) {
                str = character + str;//  w  ww. j  a v  a 2 s  .  c  o  m
            }
        }
        return str;
    }
}

Related

  1. leftPad(String str, int size, String delim)
  2. leftPad(String str, int size, String padStr)
  3. leftPad(String str, int size, String padStr)
  4. leftPad(String str, int width, char c)
  5. leftPad(String str, int width, char padding)
  6. leftPad(String string, char pad, int size)
  7. leftPad(String string, int length)
  8. leftPad(String strInput, int intLength)
  9. leftPad(String targetStr, char appendChar, int length)