如何作家转换为字符串 [英] How to convert Writer to String
本文介绍了如何作家转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Writer writer = new Writer();
String data = writer.toString();/* the value is not casting and displaying null...*/
有一个作家转换为字符串的任何其他方式?
Is there any other way to convert a writer to string?
推荐答案
我会用一个专门的作家,如果我要拍一个String出来。
I would use a specialized writer if I wanted to make a String out of it.
Writer writer = new StringWriter();
String data = writer.toString(); // now it works fine
这篇关于如何作家转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文