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.github.capone.protocol.crypto.VerifyKeyTest.java
@Test(expected = VerifyKey.InvalidKeyException.class) public void keyFromInvalidStringLengthFails() throws VerifyKey.InvalidKeyException { VerifyKey.fromString(StringUtils.repeat("a", SigningKey.BYTES * 2 + 1)); }
From source file:com.github.capone.protocol.crypto.SigningKeyTest.java
@Test(expected = SigningKey.InvalidSeedException.class) public void signingKeyFromSeedWithInvalidLengthThrows() throws SigningKey.InvalidSeedException { SigningKey.fromSeed(StringUtils.repeat("a", SigningKey.BYTES * 2 + 1)); }
From source file:com.egt.core.aplicacion.Bitacora.java
public static void sayHi() { DASHES = StringUtils.repeat("-", 100); String thread = "[" + Thread.currentThread().getId() + "]" + " "; String simpleName = Bitacora.class.getSimpleName(); if (logger != null) { logger.debug(thread + DASHES);/*from w w w . j a va 2 s . co m*/ logger.debug(thread + simpleName); logger.debug(thread + DASHES); } else { System.out.println(thread + DASHES); System.out.println(thread + simpleName); System.out.println(thread + DASHES); } }
From source file:com.serphacker.serposcope.db.google.GoogleRankDBH2IT.java
@Test public void testUrlTooLongDatabase() { Group grp = new Group(Group.Module.GOOGLE, "grp"); baseDB.group.insert(grp);//from www . j av a 2 s . c o m GoogleSearch search = new GoogleSearch("keyword"); googleDB.search.insert(Arrays.asList(search), grp.getId()); GoogleTarget target = new GoogleTarget(grp.getId(), "name", GoogleTarget.PatternType.REGEX, "pattern"); googleDB.target.insert(Arrays.asList(target)); Run run = new Run(Run.Mode.CRON, Group.Module.GOOGLE, LocalDateTime.now().withNano(0)); baseDB.run.insert(run); String longUrl = StringUtils.repeat("a", 256); GoogleRank rank = new GoogleRank(run.getId(), grp.getId(), target.getId(), search.getId(), 1, 2, longUrl); assertTrue(googleDB.rank.insert(rank)); GoogleBest best = new GoogleBest(grp.getId(), target.getId(), search.getId(), 1, LocalDateTime.MIN, longUrl); assertTrue(googleDB.rank.insertBest(best)); }
From source file:com.apexxs.neonblack.utilities.TextUtilities.java
public String cleanStopwords(String text) { String cleanText = text;//from w w w.j a va 2s . c o m try { for (String stopWord : stopWords) { String repl = StringUtils.repeat("-", stopWord.length()); cleanText = cleanText.replace(stopWord, repl); } } catch (Exception ex) { logger.error("Error in cleanStopwords: " + ex.getMessage()); } return cleanText; }
From source file:de.fau.cs.osr.utils.SimpleTypeNameMapper.java
@Override public String nameForType(Class<?> n) { String typeAlias = (String) typeToName.get(n); if (typeAlias != null) return typeAlias; if (n.isArray()) { ArrayInfo dim = ReflectionUtils.arrayDimension(n); String elementTypeName = nameForType(dim.elementClass); return elementTypeName + StringUtils.repeat("[]", dim.dim); }/*from w w w . jav a 2s . c o m*/ if (ReflectionUtils.isBasicDataType(n)) return ReflectionUtils.abbreviateBasicDataTypeName(n); return nameForUnmappedType(n); }
From source file:com.temenos.interaction.command.HelloWorldCommand.java
public Result execute(InteractionContext ctx) throws InteractionException { logger.warn("\n" + StringUtils.repeat("=", 102) + "\n" + StringUtils.repeat(" ", 102) + "\n" + "|" + StringUtils.center("DEMO COMMAND WORKING AGAIN", 100) + "|\n" + StringUtils.repeat(" ", 102) + "\n" + StringUtils.repeat("=", 102) + "\n"); return wrappedCommand.execute(ctx); }
From source file:net.jofm.format.Format.java
public final String format(Object value) { if (value == null) { return StringUtils.repeat(String.valueOf(padWith), length); }/* w ww .java 2s . c om*/ String formattedValue = doFormat(value); if (formattedValue.length() < length) { if (pad == Pad.LEFT) { return StringUtils.leftPad(formattedValue, length, padWith); } else if (pad == Pad.RIGHT) { return StringUtils.rightPad(formattedValue, length, padWith); } } else if (formattedValue.length() > length) { if (logger.isWarnEnabled()) { logger.warn("The length of formatted value '" + formattedValue + "' is greater than the length(" + length + ") of the field. It is trimmed to match the length."); } return formattedValue.substring(0, length); } return formattedValue; }
From source file:gov.nasa.ensemble.common.time.SCETFloatingPointDateFormat.java
private P2<String, Boolean> removeExtraDigits(final String text) { final Matcher matcher = Pattern.compile("(^.*\\.)(\\d{0,3})(\\d*)$").matcher(text); if (matcher.matches()) { final String zeroFilled = StringUtils.repeat("0", 3 - matcher.group(2).length()); final String remainder = matcher.group(3); final String newScet = matcher.group(1) + matcher.group(2) + zeroFilled; return p(newScet, !remainder.isEmpty() && Double.parseDouble(remainder) >= .5); }//w w w. j av a 2 s . co m return p(text, false); }
From source file:com.kelveden.rastajax.core.RestDescriber.java
private static void logCreatingRepresentationHeader() { LOGGER.info(StringUtils.repeat("=", UNDERLINE_LENGTH)); LOGGER.info("Creating representation..."); LOGGER.info(StringUtils.repeat("=", UNDERLINE_LENGTH)); }