@Override public String usage() { return WordUtils.wrap( String.format( "[--%s[=<%s>]]", name, exampleValue ), 60 ); }
return wrap(str, wrapLength, null, false);
return wrap(str, wrapLength, newLineStr, wrapLongWords, " ");
@Test public void testLANG1397() throws Exception { // Prior to fix, this was throwing StringIndexOutOfBoundsException WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Integer.MAX_VALUE); } }
public String getLabel() { int wrapLength = Math.max(8 * meeting.getDurationInGrains(), 16); return "<html><center>" + WordUtils.wrap(meeting.getTopic(), wrapLength, "<br/>", false) + "</center></html>"; }
@Test public void testLANG1292() throws Exception { // Prior to fix, this was throwing StringIndexOutOfBoundsException WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",70); }
@Test public void testWrap_StringIntStringBooleanString() { //no changes test String input = "flammable/inflammable"; String expected = "flammable/inflammable"; assertEquals(expected, WordUtils.wrap(input, 30, "\n", false, "/")); // wrap on / and small width expected = "flammable\ninflammable"; assertEquals(expected, WordUtils.wrap(input, 2, "\n", false, "/")); // wrap long words on / 1 expected = "flammable\ninflammab\nle"; assertEquals(expected, WordUtils.wrap(input, 9, "\n", true, "/")); // wrap long words on / 2 expected = "flammable\ninflammable"; assertEquals(expected, WordUtils.wrap(input, 15, "\n", true, "/")); // wrap long words on / 3 input = "flammableinflammable"; expected = "flammableinflam\nmable"; assertEquals(expected, WordUtils.wrap(input, 15, "\n", true, "/")); }
@Test public void testWrap_StringInt() { assertNull(WordUtils.wrap(null, 20)); assertNull(WordUtils.wrap(null, -1)); assertEquals("", WordUtils.wrap("", 20)); assertEquals("", WordUtils.wrap("", -1)); // normal final String systemNewLine = System.lineSeparator(); String input = "Here is one line of text that is going to be wrapped after 20 columns."; String expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."; assertEquals(expected, WordUtils.wrap(input, 20)); // long word at end input = "Click here to jump to the commons website - http://commons.apache.org"; expected = "Click here to jump" + systemNewLine + "to the commons" + systemNewLine + "website -" + systemNewLine + "http://commons.apache.org"; assertEquals(expected, WordUtils.wrap(input, 20)); // long word in middle input = "Click here, http://commons.apache.org, to jump to the commons website"; expected = "Click here," + systemNewLine + "http://commons.apache.org," + systemNewLine + "to jump to the" + systemNewLine + "commons website"; assertEquals(expected, WordUtils.wrap(input, 20)); // leading spaces on a new line are stripped // trailing spaces are not stripped input = "word1 word2 word3"; expected = "word1 " + systemNewLine + "word2 " + systemNewLine + "word3"; assertEquals(expected, WordUtils.wrap(input, 7)); }
@Override public String getLongDescription() { return WordUtils.wrap(new StrBuilder() .appendln("Adamic-Adar measures the similarity between vertex neighborhoods and is " + "computed as the sum of the inverse logarithm of centerpoint degree over shared " + "neighbors.") .appendNewLine() .append("The algorithm result contains two vertex IDs and the similarity score.") .toString(), 80); }
@Override public String getLongDescription() { return WordUtils.wrap(new StrBuilder() .appendln("Hyperlink-Induced Topic Search computes two interdependent scores for " + "each vertex in a directed graph. A good \"hub\" links to good \"authorities\" " + "and good \"authorities\" are linked to from good \"hubs\".") .appendNewLine() .append("The result contains the vertex ID, hub score, and authority score.") .toString(), 80); }
@Override public String getLongDescription() { return WordUtils.wrap(new StrBuilder() .appendln("List all triangles graph.") .appendNewLine() .append("The algorithm result contains three vertex IDs. For the directed algorithm " + "the result contains an additional bitmask indicating the presence of the six " + "potential connecting edges.") .toString(), 80); }
@Override public String getLongDescription() { return WordUtils.wrap(new StrBuilder() .appendln("Jaccard Index measures the similarity between vertex neighborhoods and " + "is computed as the number of shared neighbors divided by the number of " + "distinct neighbors. Scores range from 0.0 (no shared neighbors) to 1.0 (all " + "neighbors are shared).") .appendNewLine() .append("The result contains two vertex IDs, the number of shared neighbors, and " + "the number of distinct neighbors.") .toString(), 80); }
@Override public String getLongDescription() { return WordUtils.wrap(new StrBuilder() .appendln("The local clustering coefficient measures the connectedness of each " + "vertex's neighborhood. The global clustering coefficient measures the " + "connected of the graph. The average clustering coefficient is the mean local " + "clustering coefficient. Each score ranges from 0.0 (no edges between vertex " + "neighbors) to 1.0 (neighborhood or graph is a clique).") .appendNewLine() .append("The algorithm result contains the vertex ID, degree, and number of edges " + "connecting neighbors.") .toString(), 80); }
@Test public void testWrap_StringIntStringBoolean() { assertNull(WordUtils.wrap(null, 20, "\n", false)); assertNull(WordUtils.wrap(null, 20, "\n", true)); assertNull(WordUtils.wrap(null, 20, null, true)); assertNull(WordUtils.wrap(null, 20, null, false)); assertNull(WordUtils.wrap(null, -1, null, true)); assertNull(WordUtils.wrap(null, -1, null, false)); assertEquals("", WordUtils.wrap("", 20, "\n", false)); assertEquals("", WordUtils.wrap("", 20, "\n", true)); assertEquals("", WordUtils.wrap("", 20, null, false)); assertEquals("", WordUtils.wrap("", 20, null, true)); assertEquals("", WordUtils.wrap("", -1, null, false)); assertEquals("", WordUtils.wrap("", -1, null, true)); assertEquals(expected, WordUtils.wrap(input, 20, "\n", false)); assertEquals(expected, WordUtils.wrap(input, 20, "\n", true)); assertEquals(expected, WordUtils.wrap(input, 20, "<br />", false)); assertEquals(expected, WordUtils.wrap(input, 20, "<br />", true)); assertEquals(expected, WordUtils.wrap(input, 6, "\n", false)); expected = "Here\nis\none\nline"; assertEquals(expected, WordUtils.wrap(input, 2, "\n", false)); assertEquals(expected, WordUtils.wrap(input, -1, "\n", false)); expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."; assertEquals(expected, WordUtils.wrap(input, 20, null, false));
private static String toWrappedString(Object o, int wrap) { String s = "" + o; if(wrap <= 0) { return s; } return WordUtils.wrap(s, wrap); }
b.append(ansi().fg(Color.WHITE)).append(next.getLocationString()); String[] message = WordUtils.wrap(next.getMessage(), 80 - leftWidth, "\n", true).split("\\n"); for (String line : message) { b.append(App.LINESEP);
/** * {@link WordUtils#wrap(String, int)} */ public static String wrap(final String str, final int wrapLength) { return WordUtils.wrap(str, wrapLength); }
/** * {@link WordUtils#wrap(String, int)} */ public static String wrap(final String str, final int wrapLength, final String newLineStr) { return WordUtils.wrap(str, wrapLength, newLineStr, false); } }
@Override public CharSequence apply(final Object context, final Options options) throws IOException { isTrue(context instanceof String, "found '%s', expected 'string'", context); Integer length = options.param(0, null); notNull(length, "found 'null', expected 'length'"); return WordUtils.wrap((String) context, length); }
@Override void runCmd() throws Exception { admin.functions().getConnectorsList().stream().filter(x -> isNotBlank(x.getSinkClass())) .forEach(connector -> { System.out.println(connector.getName()); System.out.println(WordUtils.wrap(connector.getDescription(), 80)); System.out.println("----------------------------------------"); }); } }