Format String Numeric to Currency
I need to read a number in the following format to 1000 and convert currency开发者_StackOverflow中文版. Note that number above "1000" realy would be 10.00. Is there any method to convert this format?
string.Format("{0:c}",your_value)
UPDATE (thanks for the comments)
string.Format("{0:c}",your_value/100);
I think you want
public String FormatValue( int valueAsCents ){
Decimal.Divide( (decimal)valueAsCents , 100.0 ).ToString("C");
}
Icarus' answer will result in $1,000, the below is what you want.
string.Format("{0:c}",your_value/100)
精彩评论