最佳实践 - 格式化多种货币 [英] Best Practice - Format Multiple Currencies

查看:30
本文介绍了最佳实践 - 格式化多种货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面列出的方案的最佳做法是什么?

What is best practice for the scenario listed below?

我们有一个希望支持多种货币的应用程序.该软件将尊重用户的区域设置和区域设置,以指示正确的数字格式,即 $10,000.00 或 10.000,00₴ 等.

We have an application which we would like to support multiple currencies. The software will respect the users locale and regional settings to dictate the correct number format, i.e. $10,000.00 or 10.000,00₴ etc.

然而,我们希望能够根据货币 ID(可能是三个字母的 ISO4217 代码)格式化不同的数字.我们的想法是在数据库中存储每种货币的表,然后请求用户选择将使用的货币符号.然后程序将根据区域设置/区域设置格式化所有数字,但将使用我们程序中定义的货币符号.

We would however like to be able to format different numbers based upon a currency ID (perhaps the three letter ISO4217 code). Our idea is to store a table in the database with each currency and then request from the user to select the currency symbol which will be used. The program will then format all numbers based upon the locale/region setting but will use the currency symbol as defined in our program.

因此,鉴于以下值和货币
10000 澳元
5989.34 美元
450 欧元

So, given the following values and currencies
10000 AUD
5989.34 USD
450 EUR

程序会输出
$10,000.00
$5,989.34
€450.00

the program would output
$10,000.00
$5,989.34
€450.00

或使用将数字格式化为 #####,##$ 的区域设置,结果将是;
10000,00$
5989,34$
450,00 欧元

or with a regional setting that formated numbers as #####,##$ the result would be;
10000,00$
5989,34$
450,00€

尊重区域设置/地区数字格式但显示不同的货币,这方面的最佳做法是什么?

Respecting locale/region number formatting but displaying different currencies, what is best practice for this?

我希望这是有道理的.

使用的技术是 c# .NET 2.0.

Technology used is c# .NET 2.0.

推荐答案

我认为这个 Q 是关于你应该做什么的一个很好而明确的答案

I think this Q is an excellent and clear answer as to WHAT you should be doing

SO - 正确的货币格式当不显示文化的本国货币时

这个 Q 对如何在 C# 中做到这一点有一个很好的回答

And this Q has a good answer of HOW to do this in C#

SO - 货币格式

这篇关于最佳实践 - 格式化多种货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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