All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.logging.generator.util.Strings Maven / Gradle / Ivy

There is a newer version: 1.0.0.CR5
Show newest version
package org.jboss.logging.generator.util;

/**
 * Date: 19.09.2011
 *
 * @author James R. Perkins
 */
public class Strings {
    private Strings() {
    }

    /**
     * Creates a string filled with the with the value of the {@code filler} parameter with a length defined by the
     * {@code len} parameter.
     *
     * @param filler the filler character.
     * @param len    the length to fill.
     *
     * @return the generated string.
     */
    public static String fill(final char filler, final int len) {
        final StringBuilder result = new StringBuilder(len);
        for (int i = 0; i < len; i++) {
            result.append(filler);
        }
        return result.toString();
    }


    /**
     * Creates a string filled with the with the value of the {@code filler} parameter with a length defined by the
     * {@code len} parameter.
     *
     * @param filler the filler sequence.
     * @param len    the length to fill.
     *
     * @return the generated string.
     */
    public static String fill(final CharSequence filler, final int len) {
        final StringBuilder result = new StringBuilder((filler.length() * len));
        for (int i = 0; i < len; i++) {
            result.append(filler);
        }
        return result.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy