1

Mac Carbon プロジェクトで CFLocale / CFNumberFormatter を使用して、数値の左側または右側に通貨記号があるかどうかを判断するにはどうすればよいですか?

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...

4

2 に答える 2

2

回避策として、通貨の値を表す文字列を作成し、文字列を検索して通貨記号の位置を特定することを開始しましたが、これは確かに怪しく見えます。

    CFNumberFormatterRef numberFormatter = CFNumberFormatterCreate(kCFAllocatorDefault, CFLocaleCopyCurrent(), kCFNumberFormatterCurrencyStyle);
    double someNumber = 0;
    CFStringRef asString = CFNumberFormatterCreateStringWithValue(kCFAllocatorDefault, numberFormatter, kCFNumberDoubleType, &someNumber);

...

気軽に丸めた新聞紙で叩いて、本当の答えを教えてください...

于 2008-10-14T07:24:09.270 に答える
0

から返されたフォーマット文字列を調べてみてくださいCFNumberFormatterGetFormat。を検索したいよう¤です\u00A4

于 2008-10-26T06:15:23.157 に答える