String right Pad - Android java.lang

Android examples for java.lang:String Pad

Description

String right Pad

Demo Code


public class Main{

    public static String rightPad(String str, int count, char c) {
        char[] pad = new char[count];
        for (int i = 0; i < count; i++) {
            pad[i] = c;//from   ww  w .j a v  a2s .c o m
        }
        return str.concat(new String(pad));
    }

}

Related Tutorials