在 stringbuilder 中修剪到一个长度。
我应该使用什么?
StringBuilder sb = new StringBuilder("203253/62331066 ");
StringBuilder sb1 = new StringBuilder("203253/62331066 ");
int newLen = Math.min(sb.length(), ACCT_LENGTH);
sb = new StringBuilder(sb.substring(0, newLen));
sb1.setLength(newLen);
System.out.println(sb);
System.out.println(sb1);
setLength(newLength)
或new StringBuilder
与substring()
?