Java String Pad Left LPad(String str, int length, String chr)

Here you can find the source of LPad(String str, int length, String chr)

Description

L Pad

License

Open Source License

Declaration

public static String LPad(String str, int length, String chr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static String LPad(String str, int length, String chr) {
        StringBuilder sb = new StringBuilder(str);
        while (sb.length() < length)
            sb.insert(0, chr);//from   w ww. j a  va  2  s .  com
        return sb.toString();
    }
}

Related

  1. lpad(String s, String fill, int len)
  2. lpad(String src, int length, char padding)
  3. lpad(String str, char pad, int len)
  4. lPad(String str, int len, char pad)
  5. lpad(String str, int len, char padding)
  6. lPad(String str, int length, String padString)
  7. lpad(String str, int size)
  8. lpad(String str, int totalPadAmount, String padChar)
  9. lpad(String str, String chr, int length)