Hi,
this is a really stupid thing (maybe off-topic).
I've got a double value (355.783.022,00) and i want to show it like is.
But Java shows it like 3.55783022E8.
I've tried to format it using the following class:
import java.text.DecimalFormat;
import java.lang.*;
import java.util.Locale;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DarFormato{
Object dato;
String patron;
public DarFormato(){
this.dato = new Object();
this.patron= "#,###.00";
}
public DarFormato(Object palabra){
this.dato = palabra;
this.patron= "#,###.00";
}
public DarFormato(Object palabra, String cadena){
this.dato = palabra;
this.patron= cadena;
}
public void setDato(Object palabra) {
this.dato = palabra;
}
public String getPatron() {
return this.patron;
}
public void setPatron(String cadena) {
this.patron = cadena;
}
public String getResultado(){
if (dato instanceof Number){
try{
DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ITALY);
DecimalFormat form = new DecimalFormat(patron, dfs);
return form.format(dato).toString();
}catch (Exception ex){
return "El error=" + ex.toString();
}
}
if (dato instanceof Date){
SimpleDateFormat form = new SimpleDateFormat("dd-MM-yyyy");
return form.format(dato).toString();
}
return dato.toString();
}
}
but the result is always the same. �What can i do?
Thankyou in advance.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com