List of usage examples for org.apache.commons.lang StringUtils repeat
public static String repeat(String str, int repeat)
Repeat a String repeat
times to form a new String.
From source file:com.swtxml.util.lang.ResourceUtilsTest.java
@Test public void testToStringInputStream() { String text = ResourceUtils.toString(getClass().getResourceAsStream("sometext.txt")); assertEquals(StringUtils.repeat(StringUtils.repeat("10", 56) + "\n", 142).trim(), text); }
From source file:com.telefonica.iot.cygnus.utils.CommonUtilsForTests.java
/** * Gets a trace head./*from ww w .j a v a2 s . c om*/ * @param originalHead * @return A trace head */ public static String getTestTraceHead(String originalHead) { String traceHead = originalHead; traceHead += " " + StringUtils.repeat("-", MAX_LEN_TEST_TRACE_HEAD - originalHead.length()); return traceHead; }
From source file:gobblin.tunnel.TalkPastServer.java
static String generateMsgFromServer(int i) { return i + " " + StringUtils.repeat("Babble babble ", 10000) + "\n"; }
From source file:edu.lternet.pasta.portal.DataPackageSurvey.java
/** * Used in the footer.jsp to add HTML space padding to the title when needed * to avoid formatting issues with Recently Added and Recently Updated * display.//ww w .j a v a 2 s .c o m * * @param the data package title * @param the minimum length of the title * @return the space padding string needed to meet the minimum length, * a sequence of HTML characters */ public static String spacePadding(String title, int minLength) { String spacePadding = ""; if (title.length() < minLength) { spacePadding = StringUtils.repeat(" ", (minLength - title.length())); } return spacePadding; }
From source file:it.BigPostRequestIT.java
@Test public void testVeryBig() throws Exception { User admin = createAdmin();// ww w. j av a 2 s. c o m String postParam = StringUtils.repeat(" ", 100); int inputs = 10000; Map<String, String> parameters = new HashMap<>(); LOG.info("before building request"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < inputs; i++) { parameters.put("param" + i, postParam); builder.append("param").append(i).append(postParam); for (int j = 0; j < 5; j++) { parameters.put("param" + j + "_" + i, ""); builder.append("param").append(j).append("_").append(i); } } LOG.info("big request size : {}, inputs : {}", builder.length(), inputs); assertTrue(login(admin.getEmail(), "password")); String result = ninjaTestBrowser.makePostRequestWithFormParameters( getServerAddress() + "/admin/debug/dummy-post", null, parameters); assertFalse(result.contains("internal server error")); }
From source file:gov.nih.nci.calims2.business.inventory.container.CoordinateHelper.java
private static String convertValue(char firstCharacter, int maximum, int value) { int length = (int) Math.floor(Math.log(maximum) / Math.log(LETTER_BASE)) + 1; if (value == 0) { return StringUtils.repeat(Character.toString(firstCharacter), length); }//from w w w. j av a2 s.c o m String result = ""; int remaining = value; while (remaining > 0) { result = Character.toString((char) (firstCharacter + remaining % LETTER_BASE)) + result; remaining /= LETTER_BASE; } while (result.length() < length) { result = firstCharacter + result; } return result; }
From source file:de.diemex.keepxp.ScrollOfKeeping.java
public static ItemStack makeScroll(int lvl, int percentage) { Validate.isTrue(lvl > 0, "Cannot have a scroll with a negative value"); Validate.isTrue(percentage <= 100 && percentage >= 0, "percentage has to be < 100 & > 0 was " + percentage); ItemStack scroll = new ItemStack(Material.ENCHANTED_BOOK); ItemMeta meat = scroll.getItemMeta(); meat.setDisplayName("Scroll of Keeping " + StringUtils.repeat("I", lvl)); //only 1-4 List<String> lore = new ArrayList<String>(); lore.add("This Scroll lets you keep " + percentage + "%"); lore.add("of your experience on death."); lore.add(""); lore.add("But if you die the Scroll is"); lore.add("lost forever!"); lore.add(""); lore.add("SOC Lvl " + lvl); meat.setLore(lore);//from w w w . j a v a 2 s .c o m scroll.setItemMeta(meat); return scroll; }
From source file:com.liveramp.cascading_ext.counters.Counter.java
private static String padSpaces(String str, int num) { int numSpaces = Math.max(0, num - str.length()); return str + StringUtils.repeat(" ", numSpaces); }
From source file:com.joshlong.esb.springintegration.modules.services.amazon.sqs.Receiver.java
@ServiceActivator public void handleNewMessage(org.springframework.integration.core.Message<?> msg) { System.out.println(StringUtils.repeat("=", 100)); Message payload = (Message) msg.getPayload(); System.out.println("the payload is " + payload); System.out.println("the msssage is " + payload.getMessageBody()); System.out.println(StringUtils.repeat("=", 100)); }
From source file:adalid.core.TabField.java
@Override protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) { String tab = verbose ? StringUtils.repeat(" ", 4) : ""; String fee = verbose ? StringUtils.repeat(tab, n) : ""; String faa = " = "; String foo = verbose ? EOL : ", "; String string = super.fieldsToString(n, key, verbose, fields, maps); if (fields || verbose) { if (verbose) { String property = _property == null ? "" : _property.getName(); string += fee + tab + "property" + faa + property + foo; }//from w w w. j a v a 2 s . co m } return string; }