java字符串转换总结

1.byte[]转String

String str = new String(strByte);

2.String转byte[]

byte[] byteArr = str.getBytes();

3.char[]转成String

char []s = {'a','b','c'};
String str1 = new String(s);
String str2 = String.valueOf(s);

4.String转成char[]

String str = "abcdef";
char[] charStr = str.toCharArray();

 

posted @ 2018-12-19 23:21  jadeshu  阅读(147)  评论(0编辑  收藏  举报