Java String Pad Left lpadding(String s, int n, String padding)

Here you can find the source of lpadding(String s, int n, String padding)

Description

lpadding

License

Apache License

Declaration

private static String lpadding(String s, int n, String padding) 

Method Source Code

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

public class Main {
    private static String lpadding(String s, int n, String padding) {
        StringBuilder strbuf = new StringBuilder();
        for (int i = 0; i < n - s.length(); i++) {
            strbuf.append(padding);/*from w ww . ja va2s  .c  o m*/
        }
        strbuf.append(s);
        return strbuf.toString();
    }
}

Related

  1. lpad(String str, int totalPadAmount, String padChar)
  2. lpad(String str, String chr, int length)
  3. lPad(String string, char[] padding, int length)
  4. lPad(String target, String fix, int length)
  5. lPad(String val, int length, String padChar)
  6. lpadSapce(final String src, final int length)
  7. lpadWithCount(String input, String str, int count)