X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FStringUtils.java;h=d33f71f4e0031710e52ed008fefa0f37f28883c4;hb=505be508ae7d3fb48122be548b310a238cfb91eb;hp=58c35de82726408b7c9b69eee7a1bf5bee5a38b8;hpb=34bb6e525628111b87a36556bbdd2719c6d7925f;p=fanfix.git diff --git a/src/jexer/bits/StringUtils.java b/src/jexer/bits/StringUtils.java index 58c35de..d33f71f 100644 --- a/src/jexer/bits/StringUtils.java +++ b/src/jexer/bits/StringUtils.java @@ -42,6 +42,11 @@ import java.util.Arrays; * * - Read/write a line of RFC4180 comma-separated values strings to/from a * list of strings. + * + * - Compute number of visible text cells for a given Unicode codepoint or + * string. + * + * - Convert bytes to and from base-64 encoding. */ public class StringUtils { @@ -467,6 +472,10 @@ public class StringUtils { * @return the number of text cell columns required to display this string */ public static int width(final String str) { + if (str == null) { + return 0; + } + int n = 0; for (int i = 0; i < str.length();) { int ch = str.codePointAt(i); @@ -609,9 +618,6 @@ public class StringUtils { * representation i accordance with RFC 2045. * @param sArr The bytes to convert. If null or length 0 * an empty array will be returned. - * @param lineSep Optional "\r\n" after 76 characters, unless end of - * file.
No line separator will be in breach of RFC 2045 which - * specifies max 76 per line but will be a little faster. * @return A BASE64 encoded array. Never null. */ public final static String toBase64(byte[] sArr) {