赞
踩
StringBuilder->String:可用StringBuilder中的toString方法
//String -> StringBuilder
String str = "hello";
StringBuilder bu = new StringBuilder(str);
//往StringBuilder中添加数据
bu.appeng("world");
System.out.println(bu); //helloworld 变成StringBuilder类型
//StringBuilder -> String
String s = bu.toStirng();
System.out.println(s); //helloworld,变成String类型
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。