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

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

Introduction

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

Prototype

public static String repeat(String str, int repeat) 

Source Link

Document

Repeat a String repeat times to form a new String.

Usage

From source file:ddf.catalog.validation.impl.SizeValidatorTest.java

@Test
public void testValidStringValue() {
    validateNoErrors(new AttributeImpl("test", StringUtils.repeat("a", 33)), 0, 36);
}

From source file:herddb.cli.TextTableBuilder.java

public void addIntestation(List<String> columns) {
    addRowInternal(columns);//w ww  . j a va  2  s .  c  o  m
    List<String> dashes = new ArrayList<>();
    for (String c : columns) {
        dashes.add(StringUtils.repeat("-", c.length()));
    }
    addRowInternal(dashes);
}

From source file:net.bible.service.format.osistohtml.LHandler.java

public LHandler(OsisToHtmlParameters parameters, HtmlTextWriter writer) {
    this.parameters = parameters;
    this.writer = writer;
    int indentCharCount = CommonUtils.getResourceInteger(R.integer.poetry_indent_chars);
    indent_html = StringUtils.repeat(HTML.NBSP, indentCharCount);
}

From source file:com.healthcit.cacure.test.AbstractIntegrationTestCase.java

protected String uuid(final String uuid) {
    return uuid + StringUtils.repeat(" ", UUID_LENGTH - uuid.length());
}

From source file:ai.grakn.graql.internal.shell.animalia.chordata.mammalia.artiodactyla.hippopotamidae.HippopotamusFactory.java

/**
 * Raise population of hippopotamus amphibius within console.
 * @param console//  www. jav  a  2  s.  c om
 */
public static void increasePop(ConsoleReader console) {
    HippopotamusFactory builder = HippopotamusFactory.builder();

    if (System.getenv("HIPPO_SIZE") != null) {
        int hippoSize = Integer.parseInt(System.getenv("HIPPO_SIZE"));
        builder.size(hippoSize);
    }

    Hippopotamus hippo = builder.build();

    try {
        for (double i = 0; i < Math.PI; i += 0.1) {
            console.println(hippo.toString().replaceAll("^|\n",
                    "\n" + StringUtils.repeat(" ", (int) (Math.sin(i) * 100))));
            console.flush();
            Thread.sleep(100);
        }
    } catch (IOException | InterruptedException e) {
        System.err.println("Supercalafrajilistichippopotamusexception");
    }

    hippo.submerge();

    console.setPrompt(hippo.toString());
}

From source file:com.kstenschke.shifter.models.shiftertypes.StringMonoCharacter.java

/**
 * Shift mono-character string//from  w  ww .  j a v a2  s. com
 *
 * @param   word Quoted word to be shifted
 * @param   isUp Shifting up or down?
 * @return  String
 */
public String getShifted(String word, boolean isUp) {
    char firstChar = word.toLowerCase().charAt(0);
    firstChar = (char) (firstChar + (isUp ? 1 : -1));

    return StringUtils.repeat(String.valueOf(firstChar), word.length());
}

From source file:com.netprogs.minecraft.plugins.social.command.util.MessageUtil.java

public static void sendHeaderMessage(CommandSender receiver, String resource, int pageNumber, int maxPages) {

    ResourcesConfig resources = SocialNetworkPlugin.getResources();

    ChatColor SPACER_COLOR = ChatColor.YELLOW;
    ChatColor TITLE_COLOR = ChatColor.AQUA;

    // create our header
    String title = resources.getResource(resource);
    if (title == null) {
        SocialNetworkPlugin.logger().log(Level.SEVERE, "Could not find resource: " + resource);
        return;/*from   www.j  av  a  2s  . com*/
    }

    title = " " + title + " ";

    if (pageNumber != 0 && maxPages != 0) {
        title += "(" + pageNumber + "/" + maxPages + ") ";
    }

    String headerSpacer = StringUtils.repeat("-", 55);

    int midPoint = ((headerSpacer.length() / 2) - (title.length() / 2));
    String start = headerSpacer.substring(0, midPoint);
    String middle = title;
    String end = headerSpacer.substring(midPoint + title.length());

    // combine it all into the final header
    String displayHeader = SPACER_COLOR + start + TITLE_COLOR + middle + SPACER_COLOR + end;

    // send the message
    displayHeader = displayHeader.replaceAll("(&([A-Fa-f0-9L-Ol-o]))", "\u00A7$2");
    receiver.sendMessage(displayHeader);
}

From source file:com.github.capone.protocol.crypto.SymmetricKeyTest.java

@Test
public void creatingKeySucceeds() throws SymmetricKey.InvalidKeyException {
    key = SymmetricKey.fromBytes(new byte[SymmetricKey.BYTES]);
    Assert.assertNotNull(key);/*from   w  w  w. j  a v  a 2s. co m*/
    Assert.assertEquals(StringUtils.repeat("0", SymmetricKey.BYTES * 2), key.toString());
}

From source file:ch.uzh.ddis.stools.topos.UuidPayloadSpout.java

@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
    super.open(conf, context, collector);
    this.payload = StringUtils.repeat(this.uuid, payloadFactor);
}

From source file:de.tudarmstadt.ukp.dkpro.core.api.resources.CompressionUtilsTest.java

@Test
public void testUncompressed() throws Exception {
    CompressionMethod compressionMethod = CompressionMethod.NONE;
    String text = StringUtils.repeat("This is a test. ", 100000);
    testCompression(compressionMethod);// w ww  . j  av a 2 s  . co  m
}