Skip to content

Commit d34ca79

Browse files
committed
chore: added Unicode utility class
1 parent 7e14c67 commit d34ca79

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • twinkle-ansi/src/main/java/org/codejive/twinkle/util
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.codejive.twinkle.util;
2+
3+
public class Unicode {
4+
public static int visibleWidth(CharSequence text) {
5+
int width = 0;
6+
SequenceIterator si = SequenceIterator.of(text);
7+
while (si.hasNext()) {
8+
si.next();
9+
width += si.width();
10+
}
11+
return width;
12+
}
13+
}

0 commit comments

Comments
 (0)