Author: tchemit Date: 2009-10-09 11:46:13 +0200 (Fri, 09 Oct 2009) New Revision: 605 Modified: trunk/src/main/java/org/nuiton/plugin/PluginHelper.java Log: add usefull method splitAndTrim Modified: trunk/src/main/java/org/nuiton/plugin/PluginHelper.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/PluginHelper.java 2009-10-09 08:18:25 UTC (rev 604) +++ trunk/src/main/java/org/nuiton/plugin/PluginHelper.java 2009-10-09 09:46:13 UTC (rev 605) @@ -123,6 +123,23 @@ } /** + * Split the given {@code text} using the {@code separator} and trim + * each part of result. + * + * @param txt text to split + * @param separator the split separator + * @return the splited text with trimmed parts. + * @since 1.1.0 + */ + public static String[] splitAndTrim(String txt, String separator) { + String[] result = txt.split(separator); + for (int i = 0, j = result.length; i < j; i++) { + result[i] = result[i].trim(); + } + return result; + } + + /** * Prefix the lines of the given content with a given prefix. * * @param prefix prefix to add on each line of text
participants (1)
-
tchemit@users.nuiton.org