Skip to content

Commit

Permalink
使用sb
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhao.dai committed May 31, 2017
1 parent eb173fc commit b566636
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ public static String utf8ToUnicode(String inStr) {
int mag = Integer.SIZE - Integer.numberOfLeadingZeros(chr1);
int chars = Math.max(((mag + (SHIFT - 1)) / SHIFT), 1);

StringBuilder builder = new StringBuilder("\\u");
sb.append("\\u");
for (int j = 0; j < SHIFT - chars; j++) {
builder.append('0');
sb.append('0');
}
builder.append(Integer.toHexString(chr1));
sb.append(builder.toString().toLowerCase());
sb.append(Integer.toHexString(chr1).toLowerCase());
}
}
return sb.toString();
Expand Down

0 comments on commit b566636

Please sign in to comment.