在Google App-Engine JAVA中将文本转换为字符串,反之亦然 [英] Converting Text to String and vise-versa in Google App-Engine JAVA
本文介绍了在Google App-Engine JAVA中将文本转换为字符串,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将字符串转换为文本
java.lang.String
至
com.google.appengine。 api.datastore.Text;
和vise-versa?
解决方案
请检查 Javadoc 关于 Text
class。它有两个方法: toString()
和 getValue()
。
但是 toString()
仅返回前70个字符。 所以,使用 getValue()
改为:
字符串值= someText.getValue();
Text
类的构造器支持初始化一个字符串值。而且(正如Javadoc所说),这个对象在施工后不能修改。
How can one convert from String to Text
java.lang.String
to
com.google.appengine.api.datastore.Text;
and vise-versa?
解决方案
Check Javadoc about Text
class. It has two methods: toString()
and getValue()
.
But toString()
returns first 70 characters only.
So, use getValue()
instead:
String value = someText.getValue();
Contructor of the Text
class supports initialization with a string value. And (as Javadoc says), this object cannot be modified after construction.
这篇关于在Google App-Engine JAVA中将文本转换为字符串,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文