git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: sort fixes
[fanfix.git]
/
src
/
jexer
/
bits
/
StringUtils.java
diff --git
a/src/jexer/bits/StringUtils.java
b/src/jexer/bits/StringUtils.java
index 2a4fc1dc152b4cbb3dc1ba5fb5dc49b4d3ca940c..d33f71f4e0031710e52ed008fefa0f37f28883c4 100644
(file)
--- 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.
*
* - 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 {
*/
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) {
* @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);
int n = 0;
for (int i = 0; i < str.length();) {
int ch = str.codePointAt(i);