/** Format the text to be sure that each line is not * more longer than the specified quantity of characters. * * @param text is the string to cut * @param column is the column number that corresponds to the splitting point. * @return the given <var>text</var> splitted in lines separated by <code>\n</code>. */ public static String[] cutStringAsArray(String text, int column) { List<String> list = new ArrayList<String>(); cutStringAlgo(text, new CutStringColumnCritera(column), new CutStringToArray(list)); String[] result = new String[list.size()]; list.toArray(result); list.clear(); return result; }
/** Format the text to be sure that each line is not * more longer than the specified critera. * * @param text is the string to cut * @param critera is the critera to respect. * @param output is the given <var>text</var> splitted in lines separated by <code>\n</code>. * @since 4.0 */ public static void cutStringAsArray(String text, CutStringCritera critera, List<String> output) { cutStringAlgo(text, critera, new CutStringToArray(output)); }
/** Format the text to be sure that each line is not * more longer than the specified quantity of characters. * * @param text is the string to cut * @param column is the column number that corresponds to the splitting point. * @return the given <var>text</var> splitted in lines separated by <code>\n</code>. */ public static String cutString(String text, int column) { StringBuilder buffer = new StringBuilder(); cutStringAlgo(text, new CutStringColumnCritera(column), new CutStringToString(buffer)); return buffer.toString(); }