如何获得系统的货币符号的字符串 [英] How to get system currency symbol to a string

查看:208
本文介绍了如何获得系统的货币符号的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我这样做:

Console.Write("The sum is {0:c}", 12);



我是一个瑞典的计算机上,因此将返回:
的总和是12,00 KR

但有越来越只是货币符号的简单方式,无需多少?
这样的(这显然是不行的,但只是为了显示我后):

But is there a simple way of getting just the currency symbol, without a number? Like this (obviously this doesn't work, but just to show what I'm after):

 Console.Write("The symbol is {c}");



我想,要输出:的符号是KR

推荐答案

此代码应该返回你正在寻找的货币符号。

This code should return the currency symbol you're looking for.

System.Globalization.RegionInfo.CurrentRegion.CurrencySymbol

您也可以改用以下,以获得ISO货币符号

You could also use the following instead to get the ISO currency symbol

System.Globalization.RegionInfo.CurrentRegion.ISOCurrencySymbol

这篇关于如何获得系统的货币符号的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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