开发者

String representation of small amounts of money

开发者 https://www.devze.com 2022-12-12 13:28 出处:网络
Formatting large amounts of money is not an issue (e.g. converting a decimal to dollars): myDecimal.ToString(\"C\", {some culture info});

Formatting large amounts of money is not an issue (e.g. converting a decimal to dollars):

myDecimal.ToString("C", {some culture info});

However, my current problem is开发者_StackOverflow dealing with very small amounts of money (e.g. cents/pence, etc.) and rather than formatting 5 cents as $0.05 (or 5 pence as £0.05), I need to format as 5¢ or 5p. Is there anything built in to the .NET framework to handle this? Or am I stuck rolling my own?


I'm pretty certain that you're on your own, I'm afraid. Sorry that doesn't help much.

There is only NumberFormatInfo.CurrencySymbol - nothing more granular.

0

精彩评论

暂无评论...
验证码 换一张
取 消