[Mono-devel-list] Brazilian currency in Mono

Jurandy Martins Soares Junior jurandy at lsd.ic.unicamp.br
Wed Oct 6 14:39:24 EDT 2004


> > >I've tried to make Mono print a >>double<< as currency, using the format
> > >of my country. See code below:
> > >
> > >     double total = 7.50;
> > >     IFormatProvider formato = new CultureInfo("pt-br", true);
> > >     msg.Text = String.Format("{0:c}", total);
> > >
> > >It prints "R$8" rather than "R$7,50".
> > >It rounds the value. In brazilian portuguese comma is the separator.
> >

Meanwhile, I'm using code below, that worked:
    double total = 7.50;
    IFormatProvider formato = new CultureInfo("en-US", true);
    String aux = String.Format("{0:c}", total);
    aux = aux.Replace(",", "-");
    aux = aux.Replace(".", ",");
    aux = aux.Replace("-", ".");
    aux = aux.Replace("$", "R$");

Regards,
Jurandy Martins



More information about the Mono-devel-list mailing list