Home > Software engineering >  how do i delete extra zeros in mvc?
how do i delete extra zeros in mvc?

Time:09-15

I'm taking DATA like 10.0000000000 but my real data 10,00
how can change this format ?

I'm using this code; item.sbirimfiyati = String.Format("{?}", item.cbirimfiyati);

CodePudding user response:

ı want convert 10.0000000000(extra 10 zero) to 10,00 because ı need see on table 10,00

but when ı used this ;

string.Format("{0:c0}",myvalue);

I am seeing that 1.000.000.000,00

I need to delete the extra 10 zeros. :(

CodePudding user response:

You can use this custom code. This is working fine.

double yourValue = 10.0000000000;
int x = Convert.ToInt32(yourValue);
string har = String.Format("{0},00", x); // output: 10,00
  • Related