Android String Pad padString(String source)

Here you can find the source of padString(String source)

Description

pad String

Declaration

private static String padString(String source) 

Method Source Code

//package com.java2s;

public class Main {
    private static String padString(String source) {
        char paddingChar = ' ';
        int size = 16;
        int x = source.length() % size;
        int padLength = size - x;

        for (int i = 0; i < padLength; i++) {
            source += paddingChar;/*from   w  w  w.j  a  v a  2 s  .c  om*/
        }
        return source;
    }
}

Related

  1. toPaddedString(String source, int length, char pad, boolean trailing)
  2. toPaddedString(String source, int length, String pad, boolean trailing)
  3. padLeft(String str, char padding, int upTo)