2
I’m trying to convert a monetary value to decimal, the value 1.000,00
. When I do the conversion and display only the whole number 100000
the decimal point no longer exists.
How to solve this ?
I’m trying like this.
string s = "1.000,00";
decimal d = decimal.Parse(s.Replace(".","").Replace(",", "."));
Console.WriteLine(d);
//console output = 100000
Alternative solution: http://answall.com/a/48425/101 One more customized: http://answall.com/a/44962/101
– Maniero
@bigown in case the link q vc flw are using for display I want to format to record in the database. In case of writing to the database should be with dot and not comma, correct ?
– FernandoPaiva
It doesn’t matter where it will be used. After it is converted to decimal, it is a number, there is no point.Number is not text.
– Maniero
I’ll test, whatever thing warning here.
– FernandoPaiva
You’re converting "1,000.00" to "1000.00" and then decimal, and at the last step you get 100000 as a result? Are you sure your environment recognizes "." as the decimal separator, or is using Brazilian format and expects "," there?
– lpacheco