GWT中的字符串格式化程序 [英] String Formatter in GWT
本文介绍了GWT中的字符串格式化程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何在GWT中格式化字符串?
我做了一个方法
Formatter format = new Formatter();
int matches = 0;
Formatter formattedString = format.format(%d numbers(s,args)in correct position,matches);
返回formattedString.toString();
但它抱怨说
<$ p $文件%20和%20设置/ kkshetri / workspace / MasterMind / MasterMind / src / com / kunjan / MasterMind / src / com / kunjan / MasterMind /客户端/ MasterMind.java'
[错误]第84行:没有源代码可用于java.util.Formatter类型;你忘了继承一个必需的模块吗?
是否包含格式器?
解决方案
更新:请先看看Joseph Lust的帖子,然后继续寻找答案。
看起来像formatter isn'包括根据这篇文章 。但是,他们建议了一些替代品。
How do I format my string in GWT?
I made a method
Formatter format = new Formatter();
int matches = 0;
Formatter formattedString = format.format("%d numbers(s, args) in correct position", matches);
return formattedString.toString();
But it complains by saying
Validating newly compiled units
[ERROR] Errors in 'file:/C:/Documents%20and%20Settings/kkshetri/workspace/MasterMind/MasterMind/src/com/kunjan/MasterMind/client/MasterMind.java'
[ERROR] Line 84: No source code is available for type java.util.Formatter; did you forget to inherit a required module?
Isn't Formatter included?
解决方案
UPDATE: Please see (and vote up) Joseph Lust's post below before looking further at this answer.
Looks like formatter isn't included according to this post. However, they suggest some alternatives.
这篇关于GWT中的字符串格式化程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文