Example usage for org.apache.commons.lang3 StringUtils repeat

List of usage examples for org.apache.commons.lang3 StringUtils repeat

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils repeat.

Prototype

public static String repeat(final char ch, final int repeat) 

Source Link

Document

<p>Returns padding using the specified delimiter repeated to a given length.</p> <pre> StringUtils.repeat('e', 0) = "" StringUtils.repeat('e', 3) = "eee" StringUtils.repeat('e', -2) = "" </pre> <p>Note: this method doesn't not support padding with <a href="http://www.unicode.org/glossary/#supplementary_character">Unicode Supplementary Characters</a> as they require a pair of char s to be represented.

Usage

From source file:info.mikaelsvensson.devtools.analysis.db2eventlog.Db2EventLogReportGenerator.java

private static void printHeader(PrintStream stream, String header) {
    stream.println();//from   w  ww .  ja v a  2s .  co  m
    stream.println(header);
    stream.println(StringUtils.repeat('-', header.length()));
    stream.println();
}

From source file:br.usp.poli.lta.cereda.aa.examples.ExampleUtils.java

/**
 * Gera uma cadeia de comprimento n, no formato a^n b^n c^n.
 * @param value Comprimento de cada parcial.
 * @return Retorna a cadeia gerada.//ww w.  jav  a2s. co  m
 */
public static String generate(int value) {
    return StringUtils.repeat("a", value).concat(StringUtils.repeat("b", value))
            .concat(StringUtils.repeat("c", value));
}

From source file:com.navercorp.pinpoint.web.calltree.span.CallTreeAssert.java

private static String getDepthString(CallTreeNode node) {
    return StringUtils.repeat('#', node.getDepth() + 1);
}

From source file:cop.raml.utils.javadoc.JavaDocUtils.java

public static String getText(List<String> lines) {
    if (CollectionUtils.isEmpty(lines))
        return null;

    StringBuilder buf = new StringBuilder();
    int emptyLines = 0;

    for (String line : lines) {
        if (StringUtils.isBlank(line)) {
            if (buf.length() > 0)
                emptyLines++;//from w w w . j av a 2s . c  om
        } else if (JavaDocTag.startsWith(line))
            break;
        else
            buf.append(StringUtils.repeat("\n", emptyLines + (buf.length() > 0 ? 1 : 0))).append(line);
    }

    return clearMacros(buf.toString());
}

From source file:kenh.expl.functions.Repeat.java

public String process(String str, int repeat) {
    return StringUtils.repeat(str, repeat);
}

From source file:com.lostinsoftware.xsdparser.XSDParserTest.java

private static void printData(XSDElement xsdElement, int level) {

    String margin = StringUtils.repeat(" ", level);

    System.out.println(margin + "Element " + xsdElement.getName() + " ->" + " minOcurres="
            + xsdElement.getMinOcurrs() + " maxOcurres=" + xsdElement.getMaxOcurrs() + " unbounded="
            + xsdElement.isMaxOcurrsUnbounded() + " type=" + xsdElement.getType() + " default="
            + xsdElement.getDefaultValue());

    for (XSDAttribute attribute : xsdElement.getAttributes()) {
        System.out.println(margin + "-- " + attribute.getName() + " ->" + " type=" + attribute.getType()
                + " required=" + attribute.isRequired() + " default=" + attribute.getDefaultValue());
        for (String option : attribute.getOptions()) {
            System.out.println(margin + "---- " + option);
        }//ww  w.ja  v a2 s  .  c o m
    }
    if (xsdElement.getChildren().size() > 0) {
        System.out.println(margin + "Children of " + xsdElement.getName());
        for (XSDElement child : xsdElement.getChildren()) {
            printData(child, level + 2);
        }
    }

}

From source file:javasnack.snacks.xml.sax2.DebugPrinter.java

@SuppressWarnings("resource")
void start(String f, Object... args) {
    indent++;/*from  w w  w.  ja  v  a 2 s  . co m*/
    String s = new Formatter().format(f, args).toString();
    System.out.println(StringUtils.repeat(">", indent) + " " + s);
}

From source file:exm.stc.tclbackend.tree.TclTree.java

public void indent(StringBuilder sb) {
    sb.append(StringUtils.repeat(' ', indentation));
}

From source file:javasnack.snacks.xml.sax2.DebugPrinter.java

@SuppressWarnings("resource")
void print(String f, Object... args) {
    String s = new Formatter().format(f, args).toString();
    System.out.println(StringUtils.repeat(">", indent) + " " + s);
}

From source file:ch.cyberduck.core.ftp.LoggingProtocolCommandListener.java

@Override
public void protocolCommandSent(final ProtocolCommandEvent event) {
    final String message = StringUtils.chomp(event.getMessage());
    if (message.startsWith(FTPCmd.PASS.name())) {
        this.log(Type.request, String.format("%s %s", FTPCmd.PASS.name(), StringUtils.repeat("*",
                StringUtils.length(StringUtils.removeStart(message, FTPCmd.PASS.name())))));
    } else {//from   w w w.  j a v a2  s .com
        this.log(Type.request, message);
    }
}