Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Formatting a number, placing the decimal in the proper place (http://www.velocityreviews.com/forums/t136218-formatting-a-number-placing-the-decimal-in-the-proper-place.html)

BoomerangThree 08-20-2004 01:43 AM

Formatting a number, placing the decimal in the proper place
 
Can someone help me out on formatting a number and getting the decimal in
the right place?

1) I have the number 8883.
2) I would like to format the number so it shows up as 88.33.

Thanks for any support, past, present, and future...

--
BoomerangThree



Andrew Thompson 08-20-2004 02:18 AM

Re: Formatting a number, placing the decimal in the proper place
 
On Thu, 19 Aug 2004 21:43:15 -0400, BoomerangThree wrote:

Hi BoomerangThree..

Is there some more significance to that name?

The 'Boomerang', I understand, since I have
already seen this exact same post on
c.l.j.help, more commonly referred to
'round here as multi-posting, further details..
<http://www.physci.org/codes/javafaq.jsp#xpost>

BTW, Please don't (multi-post).

No, what *I* was wondering about your name is,
...does the 'Three' mean I am about to see this
same post in a *third* group?

I recommend you restrict your posts to c.l.j.help
for the time being, and you might want to zip on
back and ensure that you make your expected inputs
and outputs clear..

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

BoomerangThree 08-20-2004 02:32 AM

Re: Formatting a number, placing the decimal in the proper place
 
Understand. Won't happen again.


"Andrew Thompson" <SeeMySites@www.invalid> wrote in message
news:lm97wks2b3qn$.c77rds6hfnhu.dlg@40tude.net...
> On Thu, 19 Aug 2004 21:43:15 -0400, BoomerangThree wrote:
>
> Hi BoomerangThree..
>
> Is there some more significance to that name?
>
> The 'Boomerang', I understand, since I have
> already seen this exact same post on
> c.l.j.help, more commonly referred to
> 'round here as multi-posting, further details..
> <http://www.physci.org/codes/javafaq.jsp#xpost>
>
> BTW, Please don't (multi-post).
>
> No, what *I* was wondering about your name is,
> ..does the 'Three' mean I am about to see this
> same post in a *third* group?
>
> I recommend you restrict your posts to c.l.j.help
> for the time being, and you might want to zip on
> back and ensure that you make your expected inputs
> and outputs clear..
>
> --
> Andrew Thompson
> http://www.PhySci.org/ Open-source software suite
> http://www.PhySci.org/codes/ Web & IT Help
> http://www.1point1C.org/ Science & Technology




Jacob 08-20-2004 05:49 AM

Re: Formatting a number, placing the decimal in the proper place
 
BoomerangThree wrote:

> Can someone help me out on formatting a number and getting the decimal in
> the right place?
>
> 1) I have the number 8883.
> 2) I would like to format the number so it shows up as 88.33.


Look at java.text.DecimalFormat. You can use it to transform
a double number to a string in just about any conceivable way.

BUT: It will not change the number as such, so you'd have to
produce the correct value first, possibly by dividing by 100
(taken that 8883 -> 8833 is a typo).

An alternative approach if your input is just a sequence of
*characters* (a String) rather than a number, you can produce
your desired output by string manipulation, i.e. insert a
decimal point at the correct spot in the string



All times are GMT. The time now is 06:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.