Hey,
how can I set the number of decimals?
Example:
5 decimals 2.12345
2 decimals 2.12
I've found something about NumberFormat in the API, but without an example I
can't solve this...
Thanks in advance,
Oswald 3 5648
nfDollars = NumberFormat.ge tInstance();
nfDollars.setMa ximumFractionDi gits(2);
nfDollars.setMi nimumFractionDi gits(2);
double ss = 1.2323;
String s = nfDollars.forma t(ss).toString( );
"Oswald" <fl*********@ho tmail.com> wrote in message
news:3f******** *************** @reader2.news.s kynet.be... Hey,
how can I set the number of decimals?
Example: 5 decimals 2.12345 2 decimals 2.12
I've found something about NumberFormat in the API, but without an example
I can't solve this...
Thanks in advance, Oswald
I had to wait till i got home to answer this one, didn't have my docs on me
at work.
This is what i used when i needed to format things a specific way
DecimalFormat money = new DecimalFormat(" $###,###,###.00 ");
then when ever you need to format something just do
money.format(va lue);
i belive you need to import java.text.* for that one
hoped that helped
Nick
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Thanks guys,
this really helped me out!
"Oswald" <fl*********@ho tmail.com> wrote in message
news:3f******** *************** @reader2.news.s kynet.be... Hey,
how can I set the number of decimals?
Example: 5 decimals 2.12345 2 decimals 2.12
I've found something about NumberFormat in the API, but without an example
I can't solve this...
Thanks in advance, Oswald
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andreas Emmert |
last post by:
Hi there,
I'm trying to import a csv file into my MySQL database. Unfortunately the
number format for the price column is formatted in German style, i.e. XX,XX
(decimals separated by comma not by dot). When importing this file using
LOAD DATA LOCAL INFILE the decimals are cut off. I'm using column type FLOAT
for the price column in my database.
Is there any chance to preserve the decimals when importing the csv file
into my database...
|
by: SoLRaC |
last post by:
I have a form, and i want with javascript round a number with 2
decimals to de uper next 0 or five.
IE if you have the number 4,53 it must be rounded to 4,55. Until now i
wrote that
var valor
function redondeo(valor){
valor= valor *100;
|
by: Protoman |
last post by:
Hi!!! Protoman here, I need to write an infinite precision number class
b/c I want to compute pi. Give me some sample code. Also, when I run my
program and it computes pi, will my computer freeze b/c it's infinite
precision? Thanks for the help!
|
by: Johnny Lee |
last post by:
Hi,
Pls take a look at this code:
----------
>>> t1 = "1130748744"
>>> t2 = "461"
>>> t3 = "1130748744"
>>> t4 = "500"
>>> time1 = t1+"."+t2
>>> time2 = t3+"."+t4
|
by: Donal McWeeney |
last post by:
Hi,
Is there a way to specify on the predefined format strings like P and N that
you want displayed all the decimals in the number...
for example
3 will display 3
2.1 will display 2.1
3.21 will display 3.21
| |
by: Dimos |
last post by:
Hello All,
I need some help with random number generation. What I
need exactly is:
To create a few thousand numbers, decimal and
integers, between 5 and 90,
and then to export them as a single column at a
spreadsheet.
|
by: Chris Davoli |
last post by:
The folllowing will round to 526, but it should round to 527. It works
correctly for all other numbers, except for this one. Does anybody know of a
bug in Math.Round?
Dim ldecWater As Decimal = 526.5
CType(Math.Round(ldecWater, 0), String)
--
Chris Davoli
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?
-----------------------------------------------------------------------
When formatting money for example, to format 6.57634 to
6.58, 6.5 to 6.50, and 6 to 6.00?
Rounding of x.xx5 is uncertain, as such numbers are not
represented exactly.
|
by: TSGB |
last post by:
Hi,
I have a Table which has 2 Double, Fixed Number fields to 3 decimal places.
This fields are populated as the result of 2 division operations which lead to multiple decimals (the numbers show with 3 decimals in the tables, forms, etc).
I need to combine both of those fields on a form (text boxes)in another text box with a series of different operands, like /, *, ± etc. =&"±"& but I cannot get it to work without showing all the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |