|
From: John M. <joh...@ya...> - 2001-02-25 03:12:37
|
Any comments on the following. I'm translating Jython code to Java and
I need help formatting numbers. Is the printf-style formatting code in
Jython available on a stand-alone basis? Any suggestions?
--- John Mudd <joh...@ya...> wrote:
> Date: Sat, 24 Feb 2001 19:09:38 -0800 (PST)
> From: John Mudd <joh...@ya...>
> Subject: Java printf
> To: xxxxxxxxxxxxxxxxxxxxxxx
>
> This is the best printf answer I've seen so far. See FAQ answer down
> below.
>
> Hmmm... I wonder what others on my project use?? Hmmm... Jython has
> the print format capability built-in. It looks like it's in
> org/python/core/PyString.java. But I can't just steal that code...
> even though I'm free to use Jython as a whole? Hmmm... or can I?
>
>
> The Lava jprintf license is only $100 for source. The web page says
> it's "the best".
>
> I downloaded the horstmann code. Here's a sample from Jython
> interpreter sesion. Good enough but... [[[ Permission to use, copy,
> modify, and distribute this software and its documentation for
> NON-COMMERCIAL purposes ]]]. Ugh... I technically can't use it.
>
>
> Linux: /home/mudd/misc[1] jython
> Jython 2.0 on java1.2.2-RC2 (JIT: javacomp)
> Type "copyright", "credits" or "license" for more information.
> >>> import Format
> >>> Format('%05d').form(123)
> '00123'
> >>> Format('------>%05d<-------').form(123)
> '------>00123<-------'
> >>>
>
>
> Oh! Try to format stuff using native Java crap. This might be the
> best example of weakness in Java. Geez!
>
>
>
>
> ---
>
> FAQ:
> http://www.landfield.com/faqs/computer-lang/java/programmers/faq/
>
> ---
>
> 13. (Sect. 7) How do I do formatted I/O of floating point numbers?
>
> [*] Use the class java.text.NumberFormat.
>
> Or use http://www.newbie.net/sharky/lava/. Or use Cay
> Horstmann's
> http://www.horstmann.com/corejava/Format.java
> Although many utilities claim to handle all varieties of C's
> printf, as
> far as has been found, this is the only one to correctly handle
> the
> equivalent of %e in printf.
>
> See also the standard packages java.text.DecimalFormat and
> java.text.NumberFormat
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
|