File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
console/console-sink/src/main/java/com/dtstack/flink/sql/sink/console/table Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ public class TablePrintUtil {
2222 public static final int ALIGN_LEFT = 1 ;//左对齐
2323 public static final int ALIGN_RIGHT = 2 ;//右对齐
2424 public static final int ALIGN_CENTER = 3 ;//居中对齐
25+ private static final Pattern PATTERN = Pattern .compile ("[\u4e00 -\u9fa5 ]" );
2526
2627 private int align = ALIGN_CENTER ;//默认居中对齐
2728 private boolean equilong = false ;//默认不等宽
@@ -138,8 +139,8 @@ private static List<Col> getColList(Object obj) {
138139 * @return
139140 */
140141 private int getStringCharLength (String str ) {
141- Pattern p = Pattern . compile ( "[ \u4e00 - \u9fa5 ]" ); //利用正则找到中文
142- Matcher m = p .matcher (str );
142+ //利用正则找到中文
143+ Matcher m = PATTERN .matcher (str );
143144 int count = 0 ;
144145 while (m .find ()) {
145146 count ++;
@@ -219,6 +220,8 @@ public String getTableString() {
219220 sb .append (cell );
220221 for (int i = 0 ; i < right + padding ; i ++) {sb .append (s );}
221222 break ;
223+ default :
224+ break ;
222225 }
223226 sb .append (v );
224227 }
You can’t perform that action at this time.
0 commit comments