base/common/src/main/com/thesett/common/util/CommandLineParser.java
public static String rightPad(String stringToPad, String padder, int size)
    {
        if (padder.length() == 0)
        {
            return stringToPad;
        }

        StringBuffer strb = new StringBuffer(stringToPad);
        CharacterIterator sci = new StringCharacterIterator(padder);

        while (strb.length() < size)
        {
            for (char ch = sci.first(); ch != CharacterIterator.DONE; ch = sci.next())
            {
                if (strb.length() < size)
                {
                    strb.append(String.valueOf(ch));
                }
            }
        }

        return strb.toString();
    }
public static String rightPad(String stringToPad, String padder, int size)
    {
        if (padder.length() == 0)
        {
            return stringToPad;
        }

        StringBuffer strb = new StringBuffer(stringToPad);
        CharacterIterator sci = new StringCharacterIterator(padder);

        while (strb.length() < size)
        {
            for (char ch = sci.first(); ch != CharacterIterator.DONE; ch = sci.next())
            {
                if (strb.length() < size)
                {
                    strb.append(String.valueOf(ch));
                }
            }
        }

        return strb.toString();
    }
public static String rightPad ( String stringToPad , String padder , int size ) { if ( padder . length ( ) == 0 ) { return stringToPad ; } StringBuffer strb = new StringBuffer ( stringToPad ) ; CharacterIterator sci = new StringCharacterIterator ( padder ) ; while ( strb . length ( ) < size ) { for ( char ch = sci . first ( ) ; ch != CharacterIterator . DONE ; ch = sci . next ( ) ) { if ( strb . length ( ) < size ) { strb . append ( String . valueOf ( ch ) ) ; } } } return strb . toString ( ) ; }
Right pads a string with a given string to a given size. This method will repeat the padder string as many times
as is necessary until the exact specified size is reached. If the specified size is less than the size of the
original string then the original string is returned unchanged.

<pre>
Example1 - original string "cat", padder string "white", size 8 gives "catwhite".
Example2 - original string "cat", padder string "white", size 15 gives "catwhitewhitewh".
Example3 - original string "cat", padder string "white", size 2 gives "cat".
</pre>

@param  stringToPad The original string.
@param  padder      The string to pad onto the original string.
@param  size        The required size of the new string.

@return The newly padded string.
Right pads a string with a given string to a given size . This method will repeat the padder string as many times as is necessary until the exact specified size is reached . If the specified size is less than the size of the original string then the original string is returned unchanged .