diff --git a/src/fr/devinsy/util/strings/StringListUtils.java b/src/fr/devinsy/util/strings/StringListUtils.java index 253af81..ab07b94 100644 --- a/src/fr/devinsy/util/strings/StringListUtils.java +++ b/src/fr/devinsy/util/strings/StringListUtils.java @@ -18,6 +18,8 @@ */ package fr.devinsy.util.strings; +import java.util.Collection; + /** * The {@code StringUtils} class defines helper methods to string collection. * @@ -163,6 +165,34 @@ public class StringListUtils return result; } + /** + * + * @param strings + * @return + */ + public static String toStringWithBracket(final Collection strings) + { + String result; + + if (strings == null) + { + result = null; + } + else + { + StringList buffer = new StringList(); + + buffer.append("["); + buffer.append(toStringWithCommas(strings)); + buffer.append("]"); + + result = buffer.toString(); + } + + // + return result; + } + /** * * @param strings @@ -191,6 +221,26 @@ public class StringListUtils return result; } + /** + * + * @param strings + * @return + */ + public static String toStringWithBracketNotNull(final Collection strings) + { + String result; + + result = toStringWithBrackets(strings); + + if (result == null) + { + result = ""; + } + + // + return result; + } + /** * * @param strings @@ -211,6 +261,35 @@ public class StringListUtils return result; } + /** + * + * @param source + * @return + */ + public static String toStringWithBrackets(final Collection source) + { + String result; + + if (source == null) + { + result = null; + } + else + { + StringList buffer = new StringList(); + + for (String string : source) + { + buffer.append("[").append(string).append("]"); + } + + result = buffer.toString(); + } + + // + return result; + } + /** * * @param source @@ -240,6 +319,28 @@ public class StringListUtils return result; } + /** + * + * @param source + * @return + */ + public static String toStringWithCommas(final Collection source) + { + String result; + + if (source == null) + { + result = null; + } + else + { + result = new StringList(source).toStringSeparatedBy(","); + } + + // + return result; + } + /** * * @param source @@ -262,6 +363,28 @@ public class StringListUtils return result; } + /** + * + * @param source + * @return + */ + public static String toStringWithFrenchCommas(final Collection source) + { + String result; + + if (source == null) + { + result = null; + } + else + { + result = new StringList(source).toStringSeparatedBy(", "); + } + + // + return result; + } + /** * * @param source