Bonjour,
Comment peut on formaté un double sur 2 chiffre après la virgule.
double dPrix;
dPrix=12.14387
je voudrais l'avoir
dPrix=12.14
Comment fait on?
Version imprimable
Bonjour,
Comment peut on formaté un double sur 2 chiffre après la virgule.
double dPrix;
dPrix=12.14387
je voudrais l'avoir
dPrix=12.14
Comment fait on?
Bonjour,
ceci te retourne un String .Code:
1
2 DecimalFormat df = new DecimalFormat("0.00"); df.format(tavaleur) ;
http://developer.android.com/referen...malFormat.html
Edit :
Sinon autre méthode
Code:
1
2 int val = Math.round(tavaleur * 100); double newval = val /100.0;