更改货币格式,显示全球小数点后4位,而不是2 [英] Change currency format to show 4 decimal places instead of 2 globally

查看:127
本文介绍了更改货币格式,显示全球小数点后4位,而不是2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作网站,在那里我用这个EX pression无处不在。

I have a working website, where I use this expression everywhere.

price.ToString("C")

目前,它显示了2位小数,如。 $ 1.45

It currently shows 2 decimal places, eg. $1.45

现在我需要的网站,以显示小数点后4位,如。 $ 1.4515

Now I need the website to show 4 decimal places, eg. $1.4515

有没有简单的方法在全球范围内改变它?

Is there any easy way to change it globally?

推荐答案

您无法修改的格式说明符的默认行为,但你可以做AA全局搜索和替换的项目。假设你正在使用Visual Studio,你可以做一个全局搜索和替换(按Ctrl-Shift-H键)和替换的ToString(C)的ToString(C4)

You can't modify the default behavior of the format specifier, but you can do a a global search-and-replace in your project. Assuming you're using Visual Studio, you can do a global search-and-replace (Ctrl-Shift-H) and replace .ToString("C") with .ToString("C4").

这篇关于更改货币格式,显示全球小数点后4位,而不是2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆