如何确定 MacOS 上货币符号位于数字的左侧还是右侧
如何在 Mac Carbon 项目中使用 CFLocale / CFNumberFormatter 确定货币符号应该位于数字的左侧还是右侧?
我需要与电子表格应用程序交互,该应用程序要求我传递数字、货币符号、货币符号位置和填充,而不是使用 CFNumberFormatter 创建的 CStringRef。
CFLocaleRef currentLocale = CFLocaleCopyCurrent();
CFTypeRef currencySymbol = CFLocaleGetValue (currentLocale, kCFLocaleCurrencySymbol);
为我提供字符串形式的货币符号。 但我不知道如何确定货币符号的位置......
How do I determine if the currency symbol is supposed to be on the left or right of a number using CFLocale / CFNumberFormatter in a Mac Carbon project?
I need to interface with a spreadsheet application which requires me to pass a number, currency symbol, currency symbol location and padding instead of a CStringRef created with CFNumberFormatter.
CFLocaleRef currentLocale = CFLocaleCopyCurrent();
CFTypeRef currencySymbol = CFLocaleGetValue (currentLocale, kCFLocaleCurrencySymbol);
provides me with the currency symbol as a string. But I'm lost on how to determine the position of the currency symbol...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为解决方法,我已开始创建一个表示货币值的字符串,并通过搜索该字符串来确定货币符号的位置,但这对我来说确实看起来很可疑。
...
随意用卷起的报纸打我,告诉我真正的答案...
As a workaround, I have started to create a string representing a currency value and determining the position of the currency symbol by searching the string, but this sure looks fishy to me.
...
Feel free to hit me with a rolled-up newspaper and tell me the real answer...
您可以尝试检查从
CFNumberFormatterGetFormat
返回的格式字符串。 看起来您想要搜索¤ 即
\u00A4
。You could try inspecting the format string returned from
CFNumberFormatterGetFormat
. It looks like you want to search for¤
which is\u00A4
.