String formatting?

7,713 views
Skip to first unread message

Alex Rice

unread,
Aug 20, 2008, 12:02:56 PM8/20/08
to Google Web Toolkit
What's the preferred way of doing printf() style string formatting in
GWT?
I tried String.format() and it compiled but I got runtime errors .

Thanks, Alex

Jason Morris

unread,
Aug 21, 2008, 3:39:34 AM8/21/08
to Google-We...@googlegroups.com
String.format is not a GWT emulated method, check for those that are supported here:

http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(google-web-toolkit-doc-1-5)t(RefJreEmulation)

(for GWT 1.5)

In GWT format using a StringBuffer / StringBuilder and the i18n package (for
number and date formatting). Or you can use a Messages bundle (which is what we
use) to specify the ordering of your String.

http://google-web-toolkit-doc-1-5.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/Messages.html

Hope that helps a bit ;)

Alex Rice

unread,
Aug 25, 2008, 12:11:32 PM8/25/08
to Google Web Toolkit
Thanks for this info!

Alex

On Aug 21, 1:39 am, Jason Morris <lem...@gmail.com> wrote:
> String.formatis not a GWT emulated method, check for those that are supported here:
>
> http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(goog...)
>
> (for GWT 1.5)
>
> In GWTformatusing a StringBuffer / StringBuilder and the i18n package (for
> number and date formatting). Or you can use a Messages bundle (which is what we
> use) to specify the ordering of your String.
>
> http://google-web-toolkit-doc-1-5.googlecode.com/svn/javadoc/1.5/com/...
Reply all
Reply to author
Forward
0 new messages