且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将包含ASCII字符的字节数组转换为字符串

更新时间:2023-11-15 19:28:04

使用

new String(myByteArray, "UTF-8");

String类提供了

String class provides a constructor for this.

旁注:此处的第二个参数是 CharSet (字节编码),应小心处理. 此处更多.

Side note:The second argument here is the CharSet(byte encoding) which should be handled carefully. More here.