X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FStringUtils.java;h=be1c654502f58bd91554873a0b241876837a33c0;hb=34718cf9dc943306279713aec140a197fb27629a;hp=f7548aecca717c19aff3b0c60db338f5ad0fe1df;hpb=5221cf7f72655a6e27af81167a4a3f237750c7ca;p=fanfix.git diff --git a/src/be/nikiroo/utils/StringUtils.java b/src/be/nikiroo/utils/StringUtils.java index f7548ae..be1c654 100644 --- a/src/be/nikiroo/utils/StringUtils.java +++ b/src/be/nikiroo/utils/StringUtils.java @@ -156,6 +156,30 @@ public class StringUtils { return text; } + /** + * Justify a text into width-sized (at the maximum) lines and return all the + * lines concatenated into a single '\\n'-separated line of text. + * + * @param text + * the {@link String} to justify + * @param width + * the maximum size of the resulting lines + * + * @return a list of justified text lines concatenated into a single + * '\\n'-separated line of text + */ + static public String justifyTexts(String text, int width) { + StringBuilder builder = new StringBuilder(); + for (String line : justifyText(text, width, null)) { + if (builder.length() > 0) { + builder.append('\n'); + } + builder.append(line); + } + + return builder.toString(); + } + /** * Justify a text into width-sized (at the maximum) lines. * @@ -430,7 +454,10 @@ public class StringUtils { * the input data * * @return the hash + * + * @deprecated please use {@link HashUtils} */ + @Deprecated static public String getMd5Hash(String input) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -689,10 +716,10 @@ public class StringUtils { *

* Examples: *

* * @param value @@ -710,10 +737,10 @@ public class StringUtils { *

* Examples (assuming decimalPositions = 1): *

* * @param value @@ -725,7 +752,7 @@ public class StringUtils { */ public static String formatNumber(long value, int decimalPositions) { long userValue = value; - String suffix = ""; + String suffix = " "; long mult = 1; if (value >= 1000000000l) {