Re: NSNumber Format weirdness
Re: NSNumber Format weirdness
- Subject: Re: NSNumber Format weirdness
- From: Joseph Jones <email@hidden>
- Date: Fri, 28 Jan 2005 08:46:34 -0800
Thanx, that helped clarify the way formatting works.
In a nutshell you should always specify the format string with a comma
for thousands separator and a period for decimal separator. After
setting this string you then set the decimal separator and thousands
separator on the NSNumberFormatter object itself to change the format.
Funny that this isn't how the currency symbol works..
Example corrected code:
NSString* value = [NSString
stringWithFormat:@"%@#,##0.00;%@0.00;-%@#,##0.00",
[proj currency], [proj currency], [proj currency]];
[nsf setLocalizesFormat:NO];
[nsf setFormat:value];
[nsf setDecimalSeparator:[proj decimal]];
[nsf setThousandSeparator:[proj thousands]];
Thanx,
joe
On Jan 28, 2005, at 5:21 AM, jim kitchen wrote:
Dear Joe,
I think you might find some answers in this application...
See if it has what you need.
It is an appplication I looked at quite a while a go and,
although I forgot most of what this application can do,
I remember that it worked with European currency.
Take care,
jim k
On 1/27/05 10:08 PM, "Joseph Jones" <email@hidden> wrote:
Hi all,
I am trying to set a custom number format in a number formatter. The
format looks like this:
$#.##0,00;0,00;-$#.##0,00
Note that thousands are separated by a period and decimal is separated
by a comma. Pretty standard for European based currencies. I am
physically setting the thousands separator and decimal separator,
setting localizes to NO and setting the format as above. However the
formatter comes back with the following format:
$#,###.##000;0,00;-$#,###.##000
Here is the code I am using:
NSNumberFormatter* nsf = (NSNumberFormatter*)[projectCost
formatter];
[nsf setLocalizesFormat:NO];
[nsf setDecimalSeparator:dec];
[nsf setThousandSeparator:thou];
[nsf setFormat:[NSString
stringWithFormat:@"%@#%@##0%@00;0%@00;-%@#%@##0%@00",
curr, thou, dec,
dec,
curr, thou, dec]];
Anyone know what might be going on here? This is really weird and I
can't see why the format I am setting is not sticking.
TIA,
joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
<Conto 1.1.2 source.sitx>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden